scrollTo()与ipad和固定元素 [英] scrollTo() with ipad and fixed element

查看:231
本文介绍了scrollTo()与ipad和固定元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:


后固定定位按钮上的固定定位按钮上的固定定位按钮


我们正在尝试使用固定导航来滚动页面的不同部分。

We're trying to put a fixed navigation to scroll the different sections of a page.

我们'重新使用jquery scrollTo()。

We're using jquery scrollTo().

仅在ipad上,第一次单击传递没有问题,但在此之后,导航似乎被禁用。
如果我们用手滚动,甚至一点点,那么链接再次工作。

Only on ipad, the first click pass without problem, but after this one, the on the navigation seems to be disabled. If we scroll, even a little bit, with the hand, then the link's work again.

这是代码: http://lacabaneprod.com/test/

如何修复我的侧边栏?

推荐答案

几周前遇到同样的问题。

Ran into the same issue a few weeks ago.

发生这种情况的原因是因为内容获得焦点,并且点击屏幕点击侧边栏后面的内容。只有在scrollTop属性上使用scrollTo插件或jquery.animate才会发生这种情况。

The reason this happens is because the "content" gets the focus, and tapping the screen "taps" the content behind the sidebar. This only happens if you use the scrollTo plugin, or jquery.animate on the scrollTop property.

为了解决这个问题,在scrollTo动画之后,我们重新定位了窗口。

To fix this, after the scrollTo animation, we repositioned the window.

$(window).scrollTop($(window).scrollTop() + 1);    
$(window).scrollTop($(window).scrollTop() - 1);

但请记住,在iOS 5之前不支持固定位置。

But also keep in mind that fixed positions are not supported prior to iOS 5.

这篇关于scrollTo()与ipad和固定元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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