Hammer.js可以处理触摸机吗?



那是hammer.js仅处理touchstart/touchend,并且不处理touchMove?

对于我的应用程序,我需要知道触摸的路径,越多,越多越好。

谢谢

帕特里克

要获得触摸移动数据,您需要使用锅或滑动。这是PAN的示例代码:

var hammer = new Hammer(div);
// this sets pan to behave similar to normal touch/mouse input
// note that by setting the threshold to 0, pan will receive all inputs
hammer.get('pan').set({ direction: Hammer.DIRECTION_ALL, threshold: 0 }); 
hammer.on('panstart', touchstart);
hammer.on('panmove', touchmove);
hammer.on('panend', touchend);

最新更新