iPhone / iPad / iPod 滑动事件 javascript

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3666775/
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-25 01:52:38  来源:igfitidea点击:

iPhone / iPad / iPod swipe events javascript

javascriptiphoneipadipodswipe

提问by pondpad

Im looking for (if possible) javascript libraries/plugins to provide swipe events.

我正在寻找(如果可能)javascript 库/插件来提供滑动事件。

However I am not after the simple detection of a swipe, for example what jqTouch provides. I wish to create behavior similar to that of the images viewer on the iPod devices. So for example you drag left or right to go to the next image. You have to drag the image over 50% of the way and let go and it will snap to the next image. If you do not drag 50% of the image, it just snaps back to the original.

但是,我并不是在简单地检测到滑动之后,例如 jqTouch 提供的。我希望创建类似于 iPod 设备上的图像查看器的行为。例如,您向左或向右拖动以转到下一张图像。您必须将图像拖动超过 50% 的距离,然后松开,它将捕捉到下一张图像。如果您不拖动 50% 的图像,它就会恢复原状。

Any advice appreciated. Thanks.

任何建议表示赞赏。谢谢。

采纳答案by Michael Mullany

I think you might be looking for something like the Carousel componentin Sencha Touch (view on iPad/iPhone or Chrome/Safari). This has the behavior you want built in. [I work for Sencha]

我想您可能正在Sencha Touch 中寻找类似于Carousel 组件的东西(在 iPad/iPhone 或 Chrome/Safari 上查看)。这具有您想要内置的行为。 [我为 Sencha 工作]

回答by eikes

Here is a standalone solution for your problem:

这是针对您的问题的独立解决方案:

http://swipejs.com/

http://swipejs.com/

The more general solution to javascript swipe events can be found here:

可以在此处找到更通用的 javascript 滑动事件解决方案:

https://github.com/eikes/jquery.swipe-events.js

https://github.com/eikes/jquery.swipe-events.js