Advertisement
Guest User

Untitled

a guest
Apr 13th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     var slideCaptions = $('.slideCaptions > .slides');
  3.     var slideImages = $('.slideImages > .slides');
  4.     var slideHeadlines = $('.slideHeadlines > .slides');
  5.    
  6.     var delay = 3000;
  7.     var speed = 800;
  8.    
  9.     var slidesInterval = setInterval( showNext, delay );
  10.     function resetInterval() { // Resets the slide interval so that when next/previous is clicked, the show doesn't automatically move to the next slide immediately       
  11.         clearInterval(slidesInterval);
  12.         setTimeout( function() {
  13.             slidesInterval = setInterval( showNext, delay );
  14.         });
  15.     };
  16.    
  17.     slideCaptions.slideshow({
  18.         transition: 'fadeThroughBackground',
  19.         autoStyle: true,
  20.         duration:speed,
  21.         autoPlay: false
  22.     });
  23.    
  24.     slideImages.slideshow({
  25.         transition: 'push(left, false, ease)',
  26.         autoStyle: true,
  27.         duration: speed,
  28.         autoPlay: false
  29.     });
  30.  
  31.     slideHeadlines.slideshow({
  32.         transition: 'push(right, false, ease)',
  33.         autoStyle: true,
  34.         duration: speed,
  35.         autoPlay: false
  36.     });
  37.  
  38.     function showNext() {
  39.         slideImages.slideshow( 'show', 'next' );
  40.         slideHeadlines.slideshow( 'show', 'next' );
  41.         slideCaptions.slideshow( 'show', 'next');
  42.     };
  43.  
  44.     $( '.sliderNext' ).click(function(){ // Next control
  45.         resetInterval();
  46.        
  47.         slideImages.slideshow( 'show', 'next' );
  48.         slideCaptions.slideshow( 'show', 'next');
  49.         slideHeadlines.slideshow( 'show', 'next', {
  50.             transition:'push(right)'
  51.         } )
  52.     });
  53.  
  54.     $( '.sliderPrev' ).click(function(){ // Previous control
  55.         resetInterval();
  56.  
  57.         slideImages.slideshow( 'show', 'previous', {
  58.             transition:'push(right)'
  59.         } );
  60.         slideCaptions.slideshow( 'show', 'previous');
  61.  
  62.         slideHeadlines.slideshow( 'show', 'previous', {
  63.             transition:'push(left)'
  64.         } );
  65.     });
  66.    
  67.     $( '.hero' ).hover(
  68.         function() {clearInterval(slidesInterval); console.log("Hovered")},
  69.         function() {resetInterval(); console.log("Exited")}    
  70.     )
  71.  
  72. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement