【发布时间】:2013-02-07 14:02:53
【问题描述】:
有谁知道如何使用 jquery 在移动设备上设置正确的上下滑动代码?
谢谢
【问题讨论】:
-
没有代码?你试过什么?你是怎么做到的?
标签: android iphone html jquery-mobile swipe
有谁知道如何使用 jquery 在移动设备上设置正确的上下滑动代码?
谢谢
【问题讨论】:
标签: android iphone html jquery-mobile swipe
不幸的是,jQuery mobile 中不存在向上滑动和向下滑动,并且它们未计划用于 1.3 版。这里有一个 3rd 方插件:http://developingwithstyle.blogspot.com/2010/11/jquery-mobile-swipe-up-down-left-right.html。像使用普通事件一样使用它们:向下滑动和向上滑动。
如果你需要这个实现,你也可以使用这个插件:http://www.netcu.de/jquery-touchwipe-iphone-ipad-library。它也适用于安卓设备。这是最坏情况的解决方案,因为与官方活动不同,这些活动不能在桌面浏览器上运行。
$("#wrapper").touchwipe({
wipeLeft: function() {
$("#carousel").trigger("next", 1);
},
wipeRight: function() {
$("#carousel").trigger("next", 1);
},
min_move_x: 20,
min_move_y: 20,
preventDefaultEvents: true
});
编辑:
这是一个工作示例:http://jsfiddle.net/Gajotres/97h45/ 仅在 Android 和 iOS 设备上进行测试。我已经在 iOS 6 和 Android 4.1.1 上测试过了
【讨论】: