我無法獲得fadeIn
效果,無法處理圖片的點擊事件。淡入淡出效果
我希望他們在點擊時淡入... fadeOut
和fadeToggle
工作,但fadeIn
不會。我搜索並嘗試了所有發現沒有成功的事情。
我相信這是超級簡單的東西,我可以忽略但根本無法弄清楚這一點!
非常感謝您的幫助。
$(document).ready(function() {
// preload images
$("#image_list a").each(function() {
var swappedImage = new Image();
swappedImage.src = $(this).attr("href");
});
// set up event handlers for links
$("#image_list a").click(function(evt) {
var imageURL = $(this).attr("href");
$("#image").attr("src", imageURL).fadeIn(1000);
var caption = $(this).attr("title");
$("#caption").text(caption);
// cancel the default action of the link
evt.preventDefault();
}); // end click
// move focus to first thumbnail
$("li:first-child a").focus();
}); // end ready
如果你想使用'fadeIn'?我沒有看到它在你的代碼 –
$('#image')。attr(「src」,imageURL).fadeIn(1000);對不起,我從來沒有在這裏發佈過... –
你嘗試在設置源代碼後淡入圖片,對吧? – osanger