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

Add option to stop animation if the user natively scrolled #67

Closed
satazor opened this issue Feb 2, 2014 · 9 comments
Closed

Add option to stop animation if the user natively scrolled #67

satazor opened this issue Feb 2, 2014 · 9 comments
Assignees
Labels

Comments

@satazor
Copy link

satazor commented Feb 2, 2014

It would be cool to have an interrupt option. If set to true, it will interrupt the animation if the user scrolled while it was animating. If you agree with it, I can make a quick PR with it added.

@ghost ghost assigned flesler Feb 2, 2014
@flesler
Copy link
Owner

flesler commented Feb 2, 2014

It's really requested a lot. I'll add this asap.

@satazor
Copy link
Author

satazor commented Feb 2, 2014

I can make a PR if you want or do you prefer to do it?

@flesler
Copy link
Owner

flesler commented Feb 2, 2014

Ok, I might modify it a bit but will surely save time.
Thanks

@satazor
Copy link
Author

satazor commented Feb 2, 2014

@flesler little question. At the moment the done callback is only fired when the animation completes. This means that if stop() is called, it will never be called.

With the interrupt option, do you want the callback to be called when the animation is interrupted or not?

@satazor
Copy link
Author

satazor commented Feb 2, 2014

If not, we could make interrupt a boolean as well as a function. If a function is passed, it would be called instead of the callback.

Or.. add a onStop/onInterrupt similar to jQuery.

@flesler
Copy link
Owner

flesler commented Feb 3, 2014

I thought of that as well when thinking about this issue, I'm not sure.
I'll think about this when I start coding the solution. Adding additional callbacks is a feasible approach, making interrupt a boolean/function is clever but kind of inconsistent on the naming, as the end callback is called onAfter (and onBefore on localScroll and serialScroll).

What do you think.

@satazor
Copy link
Author

satazor commented Feb 3, 2014

I think adding onStop is better. It would be called on interrupt or if .stop() is called programmatically during the animation. I already got it working. Tomorrow I will make a PR for you to review or take ideas.

@westurner
Copy link

flesler added a commit that referenced this issue Mar 18, 2015
Expanded the demo with more settings
Renamed CHANGELOG
Updated ignore fields
Updated package.json to comply with jquery plugins standard
@flesler
Copy link
Owner

flesler commented Mar 18, 2015

This is implemented. To cancel on user scroll pass {interrupt:true}, if you want a callback that is called when the scroll is interrupted, you can pass a fail callback that is provided natively by jQuery. You can check the demo I updated it with an example of both settings.

@flesler flesler closed this as completed Mar 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants