移动端touch触摸事件

 

 

  <script>
    var div = document.querySelector("div");
    //触摸事件
    div.addEventListener("touchstart", function () {
      console.log("我摸了你");
    });
    // 长按显示继续摸
    div.addEventListener("touchmove", function () {
      console.log("我继续摸");
    });
    //松开鼠标
    div.addEventListener("touchend", function () {
      console.log("轻轻的我走了");
    });
  </script>

 

posted @ 2022-04-19 21:37  罗砂  阅读(30)  评论(0)    收藏  举报