javascript 捕获滑动效果以导航到 HTML5 Ipad App 中的下一页

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8208587/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 02:39:19  来源:igfitidea点击:

Capture the swipe effect to navigate to next page in HTML5 Ipad App

javascriptipadhtml

提问by 32423hjh32423

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.

我正在为 Ipad 制作在线产品目录的离线版本。它将用 HTML5 / JS 编写并利用离线图像缓存和本地存储。

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.

我希望能够在滑动方面引入与 Ipad 相同的 UI 交互。所以如果用户从右向左滑动,它将加载下一个产品。如果他们从左向右滑动,它将加载上一个图像。

How do I capture this with Javascript ?

我如何用 Javascript 捕捉这个?

回答by mamoo

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

您可以在此处查看移动 Safari 支持的事件:http: //developer.apple.com/library/IOs/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

touchstart, touchmoveand touchendevents in particular

touchstarttouchmove以及touchend事件特别

Or, if you don't want to reinvent the wheel, you can have a look at these scripts: http://cubiq.org/swipeview

或者,如果你不想重新发明轮子,你可以看看这些脚本:http: //cubiq.org/swipeview

http://plugins.jquery.com/project/swipe

http://plugins.jquery.com/project/swipe