jimmynotjim / scrollnav

A dependency free JavaScript plugin for auto generating single page navigation
http://scrollnav.com
MIT License
461 stars 127 forks source link

Boundaries Higher than Destinations #59

Closed alexclarkofficial closed 9 years ago

alexclarkofficial commented 9 years ago

Hey, loving the plugin. Just wanted to know if there is a way to set the boundaries for active state higher than the destination for the links? Thanks!

jimmynotjim commented 9 years ago

It's not really possible. What would happen is the section prior would take up the first slot in the array of "in view" sections and become the the active section. Unfortunately there isn't a great way to set the active section without knowing the viewer's intent, so I just go with the top most one within the view bounds. It's not ideal, but it's the only solution I've found that's consistent and I've tested quite a few methods.

If you can think of another way, I'd love suggestions. PRs even more, my new job has been taking up all my dev time lately.