在 HTML5 Ipad 应用程序中捕获滑动效果以导航到下一页
我正在为 iPad 制作在线产品目录的离线版本。它将用 HTML5 / JS 编写,并利用离线图像缓存和本地存储。
我希望能够在滑动方面引入与 iPad 相同的 UI 交互。因此,如果用户从右向左滑动,它将加载下一个产品。如果他们从左向右滑动,它将加载上一张图像。
我如何用 Javascript 捕获这个?
I'm making an offline version of an online products catalogue for the Ipad. It will be written in HTML5 / JS and utilise offline image caching and localstorage.
I want to be able to introduce the same UI interactions as come with the Ipad in terms of swiping. So if the user swipes from right to left, it will load the next product. If they swipe from left to right, it will load the previous image.
How do I capture this with Javascript ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在此处查看移动 Safari 支持的事件:
http://developer.apple.com/library/IOs/# Documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
touchstart
、touchmove
和特别是touchend
事件或者,如果你不想重新发明轮子,你可以看看这些脚本:
http://cubiq.org/swipeview
http ://plugins.jquery.com/project/swipe
You can have a look at the events supported by mobile Safari here:
http://developer.apple.com/library/IOs/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
touchstart
,touchmove
andtouchend
events in particularOr, if you don't want to reinvent the wheel, you can have a look at these scripts:
http://cubiq.org/swipeview
http://plugins.jquery.com/project/swipe