如何在 iPhone/Android 上捕获滚动开始事件
我在移动网站上使用 JQuery,在没有位置:固定支持的情况下重新定位滚动上的标题导航。当用户停止滚动时,标题会放回页面顶部,效果很好。
为了增强用户的体验,我想在用户开始滚动时隐藏()标题,然后在停止时将其滑入。问题是滚动事件仅在用户停止滚动时触发。我读到有 iOS 特定的触摸事件,但是有什么方法可以使用共同的代码捕获 iOS 和 Android 上的滚动启动事件吗?
谢谢
I'm using JQuery with a mobile site to reposition the header nav on scroll in the absence of position:fixed support. That works fine, when the user stops scrolling the header is placed back at the top of the page.
To enhance the experience for the user I want to hide() the header when the user starts to scroll and then have it slide in when they stop. The problem is that the scroll event only fires when the user stops scrolling. I've read that there are iOS specific touch events but is there any way I can capture a scroll start event on iOS and Android using mutually common code?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信 jQuery Mobile 可以做到这一点。看一下下面的代码:
I believe jQuery Mobile, can do this. Take a look at the following code:
您可以从 jQuery Touchwipe 开始:它是一个添加新事件wipeleft和wiperight的插件。
可以轻松修改它以将水平划像更改为垂直划像(将 x 更改为 y)
http://plugins.jquery.com/project/Touchwipe-iPhone-iPad -wipe-gesture
适用于 Android、IOS 和 BBOS。
You can start with jQuery Touchwipe : it's a plugin which add new events, wipeleft and wiperight.
It can be easily modified to change horizontal wipes to vertical ones (changing x's to y's)
http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture
It works on Android, IOS and BBOS.
此scrollstart 事件在android 2.3.4 的默认android 浏览器中是错误的 当用户开始滚动时,scrollstart 事件不会100% 触发。我正在尝试找出问题所在。我正在寻找在滚动启动事件之前触发的任何事件。这也可能是我的代码中某个地方的冲突事件。我需要先排除这一点。
This scrollstart event is faulty in the default android browser for android 2.3.4 The scrollstart event doesn't fire 100% of the time when the user starts a scroll. I am trying to track down problem. I am looking for any event that fires just before the scrollstart event. It could also be a conflicting event somewhere in my code. I need to rule that out first.