添加到代码中的jQuery选项卡使自动滚动(垂直)滚动到锚点之外 [英] Jquery tabs added to code makes auto scroll (vertical) scroll past anchors

查看:100
本文介绍了添加到代码中的jQuery选项卡使自动滚动(垂直)滚动到锚点之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用css-tricks代码设置了自动滚动页面,以实现平滑滚动: http://css-tricks.com/snippets/jquery/smooth-scrolling/

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

它一直都很棒,并且我刚刚在某些内容中添加了jQuery选项卡,现在它可以滚动到这些选项卡下面的主要锚点.

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.

此处的代码: http://jsfiddle.net/qR5bm/

为什么会发生这种情况,我该怎么解决?

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

推荐答案

我相信问题在于,应用滚动后,您会隐藏一堆项目.由于某种原因,它似乎干扰了计算.

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:

演示: http://jsfiddle.net/lucuma/qR5bm/1/

这篇关于添加到代码中的jQuery选项卡使自动滚动(垂直)滚动到锚点之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆