我尝试使用JQuery Hammer来监听mac(笔记本电脑)上的滑动手势,但它不起作用。
[编号]:
var hammer_options = {swipe: true, swipe_max_touches: 1, swipe_velocity: 0.2};
$(document).hammer(hammer_options).on("swipe", function(event) {
event.preventDefault();
alert(event.gesture.touches.length);
});
使用此代码,当一根手指在浏览器页面上滑动时,没有任何反应。 JQuery锤子无法在mac(笔记本电脑)上轻扫手势?
<小时/> 我的最终目标是在浏览器页面上检测四个手指轻扫 我认为[代码]应该是这样的,它是否正确?
var hammer_options = {swipe: true, swipe_max_touches: 0, swipe_velocity: 0.2};
$(document).hammer(hammer_options).on("swipe", function(event) {
event.preventDefault();
if (event.gesture.touches.length >= 4) alert("GET IT.");
});