I am using the excellent jQuery Reel plugin ( http://jquery.vostrel.cz/reel ) for the project. I would like to be attached to the window scroll event, so when the user scrolls down the page, the plugin moves 1 frame, say, every 10 pixels scroll, if the user scrolls the animation, it is canceled.
The plugin has methods with which I can pass values ββwithout problems, and I know how to bind to a window scroll event. What I'm struggling with is the last.
How can I use jQuery / JavaScript for every 10 pixels that scroll vertically in any direction, forward 1 frame in the animation? I know that I can store the scrolling of a window in a variable, but I'm not sure how to say it every time it falls into several of 10 advanced frames.
Thank you very much in advance.
EDIT
Thanks to the help of users below, I developed a solution. As below:
$(window).scroll(function() { windowScrollCount = $(this).scrollTop(); animationFrame = Math.round(windowScrollCount / 100); });
So, I get a scrollable distance in windowScrollCount, translating it into frames in animFrame and setting it back with .reel ("frame", animationFrame); I actually do this for every 100 frames, as every 10 will be fast.
source share