简体   繁体   中英

Smooth-Scroll Javascript Scrolling minus 100px (fixed header nav)

I use the smooth-scroll script from cferdinandi on github for a new single page website. The script

Everythink is working fine. But I am using a fixed top-navigation with a height of 100px .

The problem is when I click on a link the function is working and scrolls down. But because I am using the fixed header the content gets hidden behind my fixed navigation. So what I need is that the function is scrolling down but 100 pixels less than the standard. How is this possible?

Just use offset in data-options

Ex:

data-options='{ "easing": "linear", "offset" : "-100px"}'

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