0
点赞
收藏
分享

微信扫一扫

touch移动端触摸事件

是她丫 2022-06-16 阅读 109

 

 

<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>

 


举报

相关推荐

0 条评论