移动端手势滑动时 touchmove 事件不触发怎么办?
我在做一个移动端的滑动组件,监听了 touchstart 和 touchmove 事件,但发现有时候手指滑动了,touchmove 根本没触发,只触发了 touchstart 和 touchend。我试过在 touchstart 里加 event.preventDefault(),但还是不行。
这是我的监听代码:
element.addEventListener('touchstart', (e) => {
console.log('start');
});
element.addEventListener('touchmove', (e) => {
console.log('move'); // 这行经常不执行
});
element.addEventListener('touchend', (e) => {
console.log('end');
});
是不是被浏览器默认行为拦截了?该怎么解决?
暂无解答