简体   繁体   中英

Using ScrollPath jQuery plugin, any way to pause scrolling when it hits a certain element?

I am using the jQuery ScrollPath plugin, and I was wondering if their was a way to get the path to stop at each DIV for a second or so. I've seen other plugins do things like that.

I've seen it on other sites, where you keep scrolling, and it halts the scrolling for a second or so.

Here is the site I am using it on:

http://mikelegacywebdesign.com/index.html

I needed to do the same thing using jQuery Scrollpath plugin and I found a workaround way to do it, though I realise that it might not be the best way to do so.

I modified the source code of the plugin at the scrollToStep() function which is basically responsible for the actual scrolling and added a conditional check based on a flag variable in the document which when set true escapes the scrollToStep() method. Now by simply setting the flag using some external code of your choice through suitably handled setTimeout() calls, it's possible to simulate the pause at key-points in the scrollPath.

I hope this helps you.

Here is a jsfiddle with a simple delayed scroll example. I'm not sure how this would interact with the ScrollPath plugin, but it may be a good start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM