vladkras

10 lines slider

Apr 7th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var container = $('#fade'), images = container.find('img'), total = images.length, cur = 0, timeout = 4000;
  2. images.css("height", container.height()+"px").each(function(index) { // images must fit container
  3.     if (index) $(this).hide(); // hide all images except 1st one (index==0)
  4. });
  5. setInterval(function() {
  6.     $(images[cur]).fadeOut(function() { // fade out current image
  7.         cur = ( cur==total-1 ) ? 0 : cur+1; // loop images count
  8.         $(images[cur]).fadeIn(); // show next image
  9.     });
  10. }, timeout); // configurable in var line
Advertisement
Add Comment
Please, Sign In to add comment