'min_move_x' 用于 jquery 移动设备中的 'swipeleft' 事件
'min_move_x' for 'swipeleft' event in jquery mobile
如何在 jquery 移动设备中使用 'min_move_x' 进行 'swipeleft' 活动?
那是我的代码:
$("#summary_content").swipeleft( function() {
$("#page").trigger('click');
});
$("#summary_content").swiperight( function() {
$("#page").trigger('click');
}
});
我正在尝试让向左滑动功能仅在用户滑动屏幕的 80% 时才起作用。
jQM提供了一些事件配置项:http://api.jquerymobile.com/swipe/
对于min_x,使用$.event.special.swipe.horizontalDistanceThreshold
例如
$(document).on("pagecreate", "#page1", function(){
$.event.special.swipe.horizontalDistanceThreshold = 100;
$("#summary_content").swipeleft( function() {
alert('swipeleft');
$("#page").trigger('click');
});
});
这意味着您需要至少水平滑动 100px 才能触发事件。
Here is a DEMO
调整 horizontalDistanceThreshold,然后在红色框上向左滑动。
如何在 jquery 移动设备中使用 'min_move_x' 进行 'swipeleft' 活动?
那是我的代码:
$("#summary_content").swipeleft( function() {
$("#page").trigger('click');
});
$("#summary_content").swiperight( function() {
$("#page").trigger('click');
}
});
我正在尝试让向左滑动功能仅在用户滑动屏幕的 80% 时才起作用。
jQM提供了一些事件配置项:http://api.jquerymobile.com/swipe/
对于min_x,使用$.event.special.swipe.horizontalDistanceThreshold
例如
$(document).on("pagecreate", "#page1", function(){
$.event.special.swipe.horizontalDistanceThreshold = 100;
$("#summary_content").swipeleft( function() {
alert('swipeleft');
$("#page").trigger('click');
});
});
这意味着您需要至少水平滑动 100px 才能触发事件。
Here is a DEMO
调整 horizontalDistanceThreshold,然后在红色框上向左滑动。