【问题标题】:jQuery Mobile swipe down and swipe up for Android mobile site [closed]jQuery Mobile 向下滑动并向上滑动 Android 移动网站 [关闭]
【发布时间】:2013-02-07 14:02:53
【问题描述】:

有谁知道如何使用 jquery 在移动设备上设置正确的上下滑动代码?

谢谢

【问题讨论】:

标签: android iphone html jquery-mobile swipe


【解决方案1】:

不幸的是,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 上测试过了

【讨论】:

  • 我尝试使用第一个链接,该代码仅适用于桌面浏览器,不适用于移动 android 和 iphone。第二个链接。
  • 第二个链接呢?我已经用第二个解决方案示例更新了我的答案。
  • 对不起,是第二个链接.. 我正在尝试实现它,也许它可能是一个很好的解决方案..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-23
  • 1970-01-01
相关资源
最近更新 更多