简体   繁体   English

SmoothScroll滚动得太远了

[英]SmoothScroll scrolls too far

im working on my new portfolio and im having a problem that i cant fix without help. 我正在研究我的新投资组合,我遇到了一个无法帮助我无法修复的问题。 Here you have a link of my website so far: www.jsfiddle.net/Cessum/pmaefrjo/ 到目前为止,您的网站链接: www.jsfiddle.net/Cessum/pmaefrjo/

What i want is that when you click on creaties the website scrolls too far. 我想要的是,当你点击创作者时,网站滚动得太远了。 To explain it better you have to click on creaties and then remove the white menu bar with inspect element. 要更好地解释它,您必须单击creaties,然后使用inspect元素删除白色菜单栏。 After you have done that you can see that there is red color under (behind) the menu bar. 完成后,您可以看到菜单栏下面(后面)有红色。 That is the problem i want to fix. 这是我想解决的问题。 It should stop scrolling before the red gets behind the white menu bar. 它应该在红色进入白色菜单栏之前停止滚动。

Can you help me fix this? 你能帮我解决这个问题吗? Thanks! 谢谢!

To remove the height you can do this http://jsfiddle.net/pmaefrjo/1/ 要删除高度,你可以这样做http://jsfiddle.net/pmaefrjo/1/

 $('html,body').animate({
    scrollTop: target.offset().top - 50 // the height of #MenuBar
}, 1000);

OR 要么

$('html,body').animate({
    scrollTop: target.offset().top - $('#MenuBar').height()
}, 1000);

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

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