简体   繁体   English

平滑滚动Javascript滚动减负100px(固定的标题导航)

[英]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. 我将github上cferdinandi的smooth-scroll脚本用于新的单页网站。 The script 剧本

Everythink is working fine. 一切都很好。 But I am using a fixed top-navigation with a height of 100px . 但是我正在使用高度为100px的固定top-navigation

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. 所以我需要的是功能向下滚动,但比标准像素少100像素。 How is this possible? 这怎么可能?

Just use offset in data-options 只需在data-options使用offset

Ex: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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