在jQuery中滑动事件 [英] swipe events in jQuery
问题描述
我正在使用jQuery的mousewheel插件在鼠标滚动时运行一些动画,并且我正在寻找最简单/最简单的方法,即只需将滑动手势添加到现有代码上,即可在平板电脑上使用.
I'm using the mousewheel plugin for jQuery to run some animations on mouse scroll, and I'm looking for the easiest/cleanest way to simply add swipe gestures to the existing code for use on tablets.
推荐使用什么插件/库来完成此任务?我不希望只为这一部分加载整个jquery移动库,因此,我正在寻找一个类似于mousewheel插件的小插件(如果存在).
What is a recommended plugin/library to accomplish this? I don't think I want to load the entire jquery mobile library just for this one section, so I'm looking for a small plugin similar to the mousewheel plugin if one exists.
推荐答案
滑动不是事件,而是以下各项的组合:
swipe is not an event but rather combination of following:
1) touchstart
2) touchmove
3) touchend
您可以构建算法来确定是否存在滑动"以及朝哪个方向.
you can build your algo to decide if there is "swipe" and in which direction.
read this: http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html for more info
这篇关于在jQuery中滑动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!