Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Added afterFling listener #653

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added afterFling listener #653

wants to merge 2 commits into from

Conversation

OpherV
Copy link

@OpherV OpherV commented Dec 24, 2014

This enables users to be able to execute logic after the smoothScroll animation had ended

This enables users to be able to execute logic after the smoothScroll animation has ended
@@ -807,7 +810,8 @@

duration = duration * (1 - targetRatio);

_instance.animateTo((targetTop + 0.5) | 0, {easing: 'outCubic', duration: duration});
var direction = (distanceY)>0?'down':'up';
_instance.animateTo((targetTop + 0.5) | 0, {easing: 'outCubic', duration: duration, done: _listeners.afterfling(direction)});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code doesn't work, you're executing _listeners.afterfling(direction) immediately.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh, you're right!

@Prinzhorn
Copy link
Owner

Apart from the issue I just commented on, I don't think this will work at all. When you touch the screen while an animation is running, then your listener will fire even though the user is still scrolling (

_instance.stopAnimateTo();
).

@OpherV
Copy link
Author

OpherV commented Jan 5, 2015

The issue you pointed out is indeed a bug and I'll resolve it.
It's okay that the listener fires on touch, since it does so with the "stop animation" parameter set to true - so that case can be handled from within the user-specified done function

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

Successfully merging this pull request may close these issues.

2 participants