Advertisement
Guest User

Untitled

a guest
Sep 29th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function slideImages($slider){
  2.       var $active = $slider.find('.active');
  3.       var $next = ($active.next().length > 0) ? $active.next() : $slider.find('img:first');
  4.       $next.css('z-index',2);//set the z-index so the image will slide across the top of  current one
  5.       $active.css('z-index',1);//and set the current active image so it's below>
  6.       $next.animate({left:0},"slow",function(){//slide in the next image
  7.              
  8.               $next.addClass('active');//and set the new image to active
  9.         });
  10.     }
  11.  
  12.     $(document).ready(function(){
  13.     // run every 1s
  14.     $('.portfolio_slider').on('mouseover', function(){
  15.       var $this = $(this);
  16.         setInterval(function(){
  17.           slideImages($this);
  18.         }, 1000);
  19.         $(this).off('mouseover');
  20.        
  21.     })
  22. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement