onScroll event issues

113 views
Skip to first unread message

SublymeRick

unread,
May 13, 2013, 4:34:42 PM5/13/13
to isc...@googlegroups.com
I have a gradient mask that I have sitting over the the scroll area to give a revolving door type look. Everything is working fine if I use onScrollMove and then disable momentum and bouncing. However these are features I would like to have. The problem is that when you flip and release and the momentum takes over, the event is not fired as the momentum happens. The same with bouncing, once you let go of the scroller and it bounces back, the bounce movement is not firing events for the on scroll move.

Is there a different event hook I can use to execute code as the bounce and momentum animations happen?

SublymeRick

unread,
May 13, 2013, 6:08:23 PM5/13/13
to isc...@googlegroups.com
I hacked up a fix for this. I added an event option called onAnimationScroll - Here is the "patch" if someone wants to add it to the master

In the default options area add:

onAnimationScroll: null,

Inside the "_startAni:" function, approx line 719.
Then in side the animate = function() {
Right below the line that says "that._pos(newX, newY);"
add the following line:

if (that.options.onAnimationScroll) that.options.onAnimationScroll.call(that);

Now you can specify a call back for onAnimationScroll when you set up the scroller and then your function will be called every time an animation iterates. This works for snap, bounce and momentum animations perfectly.

Now I can ensure my overlay stays aligned with the top of the scroll area because each time a scroll pixel happens I can reposition my overlay correctly, even if the scroll happened after my mouse release during an animation.

On a side note, I had to duplicate my callback function and call it for both onScrollMove AND onAnimationScroll to cover all my bases.
Reply all
Reply to author
Forward
0 new messages