Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need a way to stop slider on demand #24

Closed
ctalkington opened this issue Nov 13, 2011 · 2 comments
Closed

need a way to stop slider on demand #24

ctalkington opened this issue Nov 13, 2011 · 2 comments

Comments

@ctalkington
Copy link

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.

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.

$('#cont').flexslider('pause');
@tylernotfound
Copy link
Contributor

Here are my suggestions:

http://pastie.org/2857802

Option 1 represents the most common case for working functions into the slider. You can take your click handling logic and insert it into the start() callback of the flexslider() call. You would then be able to use the slider element.

Option 2 represents my "for now" solution for working with the slider outside of the flexslider() scope. Not the sexiest method, but it will work until I restructure the plugin to behave another way.

@ctalkington
Copy link
Author

Option 2 seems to work decently, I had considered it before but had hoped there was a better way around it.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants