mbmufffin/FlexSlider — Issue #24: need a way to stop slider on demand
Author: ctalkington
Created: 2011-11-13 09:33:29+00:00
State: open

I love this plugin but became incredibly frustrated when I was trying to tie Youtube into the workflow.

First slide is Youtube video followed by two image slides. I have Youtube events updating a variable and if the user hasn't clicked play before the sliding interval kicks in then it should act like a normal slider but if the video is playing as known by playerState then it should pause and not go to second slide.

Basically, I have tried the before() callback, which IMHO should allow one to pause the slideshow on the spot before it progresses.

```javascript
before: function(slider){
if (playerState != -1 && playerState != 0) {
slider.pause();
}
}
```

I am new to building jQuery plugins but there should also be some way to interact with the slider object from outside itself so that people can pause/resume it based on other javascript events. ie so that when Youtube picks up a state change I can say flexslider.pause/resume(). I noticed the jQuery cycle plugin handles this by allowing you to basically call the flexslider function again like so maybe if it could work similar.

```javascript
$('#cont').flexslider('pause');
```