使用纯 JavaScript 拖动时如何停止指针事件?
let drag = false;
document.addEventListener('mousedown', () => drag = false);
document.addEventListener('mousemove', () => drag = true);
document.addEventListener('mouseup', () => console.log(drag ? 'drag' : 'click'));
// if drag: add .style.pointer-events = "none";
慕无忌1623718
相关分类