1

I'm have a three-slide slideshow going on with FlexSlider, and I'm trying to programmatically make it pause and resume. How do I do that?

Basically, I'm trying to make it stop when the user makes a modal pop up, so the stop is going to go inside a .click() function.

dauber
  • 330
  • 6
  • 20
  • 1
    Could you post some code to demonstrate what you've tried so far? – Femi Mar 06 '14 at 18:26
  • I don't even know what code TO try. The docs aren't very clear. There's no "TO stop the animation, do this; to restart, do this." – dauber Mar 06 '14 at 18:36
  • Ok. But are you currently able to somehow start the animation? What does that code look like? – Femi Mar 06 '14 at 18:52
  • The animation starts automatically. The code: $('.flexslider').flexslider({ animation: "slide", pauseOnAction: false, slideshowSpeed: 3000 }); – dauber Mar 06 '14 at 18:55
  • What I'm trying to figure out is how to stop it via an included script. – dauber Mar 06 '14 at 18:55
  • I think this question has already been asked (and answered): http://stackoverflow.com/questions/14849075/how-do-i-stop-auto-sliding-in-my-flexslider. – Femi Mar 06 '14 at 18:56
  • Nope. All that does is freeze it by default. – dauber Mar 06 '14 at 19:02
  • 1
    [THIS is what I was looking for! I need to use better search terms!][1] [1]: http://stackoverflow.com/questions/9608844/pause-flexslider-when-overlay-is-open – dauber Mar 19 '14 at 19:24

1 Answers1

2

Try calling pause() on the flexslider jQuery object, like:

var mySlider =  $('.flexslider').flexslider({
    animation: "slide",
    pauseOnAction: false,
    slideshowSpeed: 3000
});

$('#pause_button').on('click.forMySlider'
    ,function(){ mySlider.pause(); });

Taken from the developer website for Flexslider.

Femi
  • 1,332
  • 9
  • 20
  • Nope, doesn't work. The script is coming from another file and thinks "mySlider" is undefined. And if as an experiment I move the click event into the same script (which is not possible when the site is live), I'm told "mySlider.pause is not a function." And in fact, copying and pasting your code into there gives me the aforementioned "not a function" problem. – dauber Mar 06 '14 at 21:56