Add fadeIn and fadeOut effect to image lightbox JQuery
问题 I have a jQuery lightbox where the user clicks on two links 'next' and 'previous' to navigate through images. How do I fade in the new image? Here is a snippet of my code of how the new image is replacing the old image. var image = $(item).find('a').attr('href'); $('#lightbox img#image').attr('src', image); 回答1: 2 proposed solutions: Soliton 1 FadeOut (with opacity), change image, fade in again. $('#lightbox img#image').animate({ opacity: 0}, 500, function(){ $('#lightbox img#image').attr(