Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function slideImages($slider){
- var $active = $slider.find('.active');
- var $next = ($active.next().length > 0) ? $active.next() : $slider.find('img:first');
- $next.css('z-index',2);//set the z-index so the image will slide across the top of current one
- $active.css('z-index',1);//and set the current active image so it's below>
- $next.animate({left:0},"slow",function(){//slide in the next image
- $next.addClass('active');//and set the new image to active
- });
- }
- $(document).ready(function(){
- // run every 1s
- $('.portfolio_slider').on('mouseover', function(){
- var $this = $(this);
- setInterval(function(){
- slideImages($this);
- }, 1000);
- $(this).off('mouseover');
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement