Samuel Stiles
Samuel Stiles

Reputation: 2186

Why isn't my jQuery Flex Slider pausing?

I've tried all manner of things based on the documentation but no matter what I do, I can't seem to make it pause.

Here's what the documentation says:

        slider.pause()    //Function: Pause slider slideshow interval
        slider.play()    //Function: Resume slider slideshow interval

But it doesn't specify how to define the slider variable. I've tried:

    var slider = $('.flex-slider').flexslider({
        animation: "slide",
        easing: "swing",
        direction: "horizontal",
        animationLoop: true,
        slideshow: true,
        animationSpeed: 600,
        slideshowSpeed: 1200,
        controlNav: false,
        directionNav: false,
        pausePlay: false
    });

    $('.pause-button').on('click',function({
        slider.pause();
    });

Which resulted in... http://puu.sh/4qpo3.png

And I've tried:

        $('.flex-slider').flexslider().pause();

Which resulted in... http://puu.sh/4qpcS.png

And I've tried:

        $('.flex-slider').flexslider().pause(true);

Which resulted in... http://puu.sh/4qpcS.png

And all in all I'm just not seeing what exactly I'm doing wrong here.

Anyone wanna provide some insight? :)

Upvotes: 0

Views: 2185

Answers (2)

Samia Ruponti
Samia Ruponti

Reputation: 4038

Hi I see you turned off the option

 pausePlay: false

Now edit few thing. first turned on the option

pausePlay: true,
pauseText :"Pause",
playText  :"Play",

Now you will see a play pause text comes in the slider, with having two different classes for pay and pause, just add your icon image to that class with css. and you will have you desired functionality.

Upvotes: 2

putvande
putvande

Reputation: 15213

Try $('.flex-slider').flexslider('pause') and $('.flex-slider').flexslider('play').

Upvotes: 1

Related Questions