a guest Aug 3rd, 2016 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  3.     setInterval(function(){
  4.         //get current active images
  5.         var active $('#banners .active');
  6.         // if there is another image(object) left then make that image next
  7.         // if not, go back to the first image of the banners div
  8.         if( > 0 )
  9.             var next =;
  10.         else
  11.             var next = $('#banners img:first');
  12.         //get the next image ready by modifying the z-index
  13.         next.css('z-index','2');
  14.         //Fade out the active image, then
  15.         active.fadeOut(1000,function(){
  16.         //Move the active image to the back of the pile,show it and remove the active class
  17.         active.css('z-index','1').show().removeClass('active');
  18.         //make the next image the active one
  19.         next.css('z-index','3').addClass('active');
  20.         });
  21.     },2500);
  22. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand