私は現在、自分のサイトの画像をフェードするために以下を使用しています。
$(document).ready(function() {
$('ul.image-switch li').mouseover(function(e) {
if (e.target.nodeName.toLowerCase() == 'a') return;
var image_src = $('a', this).data('image');
var img = $('.image-container img');
if (img.attr('src') != image_src) { // only do the fade if other image is selected
img.fadeOut(200, function() { // fadeout current image
img.attr('src', image_src).fadeIn(200); // load and fadein new image
});
}
});
});
この動作の例はhttp://www.sehkelly.com/#newsにあります。
ご覧のとおり、新しい画像がフェードインする前に、現在の画像がフェードアウトする必要があります。
同時動作をお願いします。お願いします-私がこれを達成する方法を誰かが知っていますか?
どうもありがとう。
編集:無知な初心者。コード例は非常に高く評価されています。