touch移动端触摸事件
作者:互联网
<style> div { width: 200px; height: 200px; background-color: coral; } </style> </head> <body> <div></div> </body> <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>
标签:function,console,log,触摸,addEventListener,touch,div,移动,200px 来源: https://www.cnblogs.com/0722tian/p/16168351.html