我目前使用以下方法來淡化我的網站上的圖像:jQuery的淡入淡出和simulaneously
$(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。
正如你可以看到,當前的圖像必須淡出的新的前消失。
我想,動作要simulaneous。請 - 有誰知道我可以做到這一點?
非常感謝。
編輯:無知的新手。代碼示例非常感謝。
非常感謝。你知道我在哪裏可以找到示例代碼嗎? –
用一個快速示例編輯的答案:) – Ulflander