Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.    
  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(active.next().length > 0 )
  9.             var next = active.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. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement