davist11 / jQuery-One-Page-Nav

Smooth scrolling and smart navigation when user scrolls on one-page sites.
http://davist11.github.com/jQuery-One-Page-Nav/
MIT License
1.52k stars 501 forks source link

Need the ability to set an offset for logic determining where #165

Closed louiswalch closed 7 years ago

louiswalch commented 7 years ago

Need the ability to set an offset for scrollTo method.

I have a fixed nav which locks to the top of the viewport. With the current way the scrollTo method works the top part of active section is covered by this nav.

I've seen some "CSS Only" solutions for this problem in the Issue Archive, but this would is not sufficient. CSS impacts the page's layout, and I don't want a bunch of extra padding above each of my sections in order for the scrolling to work correctly.

It seems like allowing for an option to be passed in when initializing the plugin would be possible. Any chance you can support this?

Thank you.

davist11 commented 7 years ago

The CSS solution described in the documentation has zero impact on the design.

louiswalch commented 7 years ago

It requires extra space/padding above the section to offset the amount of the header. That impacts the design of a page.

davist11 commented 7 years ago

That's not an accurate statement as you can see from the demo: http://davist11.github.io/jQuery-One-Page-Nav/top.html