【问题标题】:Does hammer.js handle touchmove?hammer.js 是否处理 touchmove?
【发布时间】:2015-05-13 14:43:09
【问题描述】:

那个hammer.js是只处理touchstart/touchend,不处理touchmove吗?

对于我的应用,我需要知道触摸的路径,越详细越好。

谢谢

帕特里克

【问题讨论】:

    标签: javascript mobile web touch hammer.js


    【解决方案1】:

    要获取触摸移动数据,您需要使用平移或滑动。以下是 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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      • 2014-12-14
      • 2011-10-14
      • 2020-02-22
      相关资源
      最近更新 更多