Loop between images on hover


/ Published in: jQuery
Save to your folder(s)

Loop between images on hover


Copy this code and paste it in your HTML
  1. $('.fadein img:gt(0)').hide();
  2. $(".fadein").hover(function(){
  3. timer = setInterval(function(){ $('.fadein :first-child').fadeOut()
  4. .next('img').fadeIn()
  5. .end().appendTo('.fadein');},
  6. 1000);
  7. }, function() {
  8. clearInterval(timer);
  9. });
  10.  
  11.  
  12. HTML
  13. <div class="fadein">
  14. <img id="1" src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg">
  15. <img id="2" src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg">
  16. <img id="3" src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.