/ Published in: jQuery
Loop between images on hover
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('.fadein img:gt(0)').hide(); $(".fadein").hover(function(){ timer = setInterval(function(){ $('.fadein :first-child').fadeOut() .next('img').fadeIn() .end().appendTo('.fadein');}, 1000); }, function() { clearInterval(timer); }); HTML <div class="fadein"> <img id="1" src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg"> <img id="2" src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg"> <img id="3" src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">