Jump to content
Search Community

RennaNoëlle

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by RennaNoëlle

  1. Hi everyone! 

     

    I've been trying to make a slideshow with a pause button. 

    But now that I got the slideshow working, the pause button won't.. 

     

    Here is my code:

    $(function(){
    
         var $slides    = $(".slide");
         var currentSlide = 0;
         var $pauseBtn = $("#pausebtn");
                    
         TweenLite.set($slides.filter(":gt(0)"), {left:"960px"});    
         TweenLite.delayedCall(4, nextSlide);                   
                   
              function nextSlide(){                        
              TweenLite.to( $slides.eq(currentSlide), 1, {left:"-960px"} );         
                                  
                   if (currentSlide < $slides.length - 1) {
                        currentSlide++;
                   }
                   
                   else {
                        currentSlide = 0;
                   }
                                                                               
                   TweenLite.fromTo( $slides.eq(currentSlide), 1, {left: "960px"}, {left:"0px"} );
                   TweenLite.delayedCall(4, nextSlide);                                       
                   }
    
              $pauseBtn.click(function() {
                   nextSlide.stop();
              });
                        
    });
    

    Can anyone tell me why this won't work? I got the Uncaught TypeError: nextSlide.stop is not a function(…)

     

    Thanks in advance!

     

    Renna

×
×
  • Create New...