カーソルを合わせるとふわっと画像が入れ替わるようにしたいのですが
なかなかうまくいきません。
SVGの画像をJPEGの画像に重ねているのですが、JPEGの画像だけカーソルが重なった時にふわっと変わるようにしたいのですが
方法はありますでしょうか。
###ソースコード
html
1 2<div class="on-off"> 3 <img src="images/アイコン.svg" class="absolute" alt=""/> 4 <img src="images/画像1_off.jpg" alt="" class="img-responsive" /> 5 </div>
javascript
1$(function(){ 2 $('.on-off img').hover(function(){ 3 $(this).next('img').attr('src', $(this).next('img').attr('src').replace('_off', '_on'));}, 4 function(){ 5 if (!$(this).next('img').hasClass('currentPage')) { 6 $(this).next('img').attr('src', $(this).next('img').attr('src').replace('_on', '_off'));} 7 }); 8});
###補足情報(言語/FW/ツール等のバージョンなど)
Jquery1.11.3使用
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/01/27 07:31
2017/01/27 07:52