touchstart:手指按下事件,类似 mousedown
touchmove:手指移动事件,类似 mousemove
touchend:手指抬起事件,类似 mouseup
注意:移动端事件最好用事件监听函数来添加,不要用on添加
box.addEventListener('touchstart',()=>{
console.log('手指按下去了');
});
box.addEventListener('touchmove',()=>{
console.log('手指滑动了');
});
box.addEventListener('touchend',()=>{
console.log('手指抬起了');
});