I have tested the scrollTo() plugin, but I need a way to stop the scrolling animation, so I am looking at serialScroll().
Here is what I used with scrollTo:
$('#scroller').scrollTo('1000px', 3000);
My question is, how do I do this same thing with serialScroll? I can’t get it to work the same way as scrollTo, isn’t that what it is suppose to do, just add tons of extra options?!
As
SerialScrollbinds several events (incuding thestopevent) you can usetoggleto start/stop the scrolling based on clicks:On the following HTML:
Example (edit the source)
note: when the
stopevent is called the animation stops on the item being scrolled to, not immediately. So if you click on the first image while it is scrolling to the second one the animation will continue till the second image is in view and then stop. This also means that when usingcycle: true(the default) if you click during the return to the first image the animation will continue till the first image is in view and then stop.EDIT:
After looking a bit deeper I found this post on Ariel Flesler’s blog (the plugins author). In the snippets section a script is included on how to stop the animation on hover. It includes a note:
Notice the additional
stop()in the trigger. Based on the code I posted above you can change thetoggle()function to:to produce the desired effect. Updated example here (edit it)