首页 > 其他 > 详细

touch简单介绍

时间:2019-08-10 17:04:30      阅读:101      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.box{
width: 500px;
height: 500px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="box"></div>
<script>
<!--
touchstart

changedTouches 改变后的触摸点集合
targetTouches 当前元素的触发点集合
touches 页面上所有触发点集合

touchend targetTouches/touches length为0

e.touches[0] 第一个触摸点
-->
window.onload=function () {
var box=document.querySelector(".box");
box.addEventListener("touchstart",function (e) {
console.log(e);
console.log("start");
})
box.addEventListener("touchmove",function (e) {
console.log(e);
console.log("move");
})
box.addEventListener("touchend",function () {
console.log("end");
})
}
</script>
</body>
</html>

touch简单介绍

原文:https://www.cnblogs.com/cycczh/p/11331709.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!