Android 在jQuery mobile中垂直滚动时触发swipeleft/swiperight
问题是,当我想要垂直滚动时,swipeleft/SwiperRight事件被触发 我们使用的是jQuery mobile 1.1.0版本和jQuery 1.7.1 代码是:Android 在jQuery mobile中垂直滚动时触发swipeleft/swiperight,android,jquery-mobile,jquery-events,Android,Jquery Mobile,Jquery Events,问题是,当我想要垂直滚动时,swipeleft/SwiperRight事件被触发 我们使用的是jQuery mobile 1.1.0版本和jQuery 1.7.1 代码是: $(document).delegate('#quizResumePage', 'swipeleft swiperight', function (event) { event.stopImmediatePropagation(); if (event.type == 'swipeleft') {
$(document).delegate('#quizResumePage', 'swipeleft swiperight', function (event) {
event.stopImmediatePropagation();
if (event.type == 'swipeleft') {
$('#btnnext').trigger('click');
} else if (event.type == 'swiperight') {
$('#btnprevious').trigger('click');
}
event.preventDefault();
});
那么,当我想要滚动页面时,为什么要滑动事件触发器呢
这个问题发生在三星galaxy android 2.3.5中
有人能帮我解决这个问题吗?您可以控制滑动事件的工作方式,更改以下对象的值
$.extend($.event.special.swipe,{
scrollSupressionThreshold: 10, // More than this horizontal displacement, and we will suppress scrolling.
durationThreshold: 1000, // More time than this, and it isn't a swipe.
horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this.
verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this.
});
在听刷卡之前,将其放在代码上。例如,将垂直距离阈值更改为15,将持续时间阈值更改为500,这将有助于减少误报
另一方面,在您的代码中,您正在触发按钮上的单击事件,而这起作用时,更好的方法是直接调用执行下一个/上一个操作的方法
祝你好运 将
horizontaldestancethreshold
设置为Math.min($(document.width()/2160)
对我很有效。刷卡有点难,因为我发现我在上下滚动时有点像对角线一样移动,所以我只希望它滚动,而不是刷卡。我想我可以测量touchstart和touchstop。