Jquery tabs added to code makes auto scroll (vertical) scroll past anchors

不打扰是莪最后的温柔 提交于 2019-12-11 20:08:15

问题


I have set up a autoscroll page using the css-tricks code for smooth scrolling: http://css-tricks.com/snippets/jquery/smooth-scrolling/

It has always worked great, and I have just added jquery tabs to some of the content which now makes it scroll past the main anchors that are below the tabs.

Code here: http://jsfiddle.net/qR5bm/

Why is this happening and what can I do to fix it?


回答1:


I believe the issue is that after you apply the scrolling you are hiding a bunch of items. For some reason it seems to be interfering with the calculations.

If you move the smooth scrolling code below the tab functions, it will work fine:

Demo: http://jsfiddle.net/lucuma/qR5bm/1/



来源:https://stackoverflow.com/questions/11015824/jquery-tabs-added-to-code-makes-auto-scroll-vertical-scroll-past-anchors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!