0
我正试图在jquery mobile中查找滑动的水平距离。在每个交换中,它仅返回其默认值(30)。 我已经通过以下方式尝试:
$('.ad-thumb-list').on("swipeleft swiperight",function(event){
//alert("swipe");
if(event.type == 'swipeleft'){
// alert("left");
alert($.event.special.swipe.horizontalDistanceThreshold); //i expect the different threshold values in different swipe..
galleries[0].nextImage();
}
else if(event.type == 'swiperight'){
//alert("right");
galleries[0].prevImage();
}
});
P.S我使用AD画廊插件。
30px是用户为了触发滑动事件而应该通过的最小水平距离,所以它总是固定的。使用触摸事件来计算距离。 – Omar
先生,请您详细说明一下吗?我尝试点击,敲打。我仍然没有得到结果。 – RamGrg
我不确定是否有一个内置的方式让JQM显示你刷过多少像素,你可能需要一个替代方案--- http://labs.rampinteractive.co.uk/touchSwipe/demos/Swipe_status.html – Tasos