JS 对同一元素同时添加单击和双击事件 醉卧麦浪听风吟 2020-11-07 660 阅读1分钟 思路 将单击事件写在定时器 setTimeout 里面延迟执行;如果是双击的话将这个定时器清除。 代码 let timer = null // 单击事件 function clickEvent() { this.timer = setTimeout(() => { // some code }, 200) } // 双击事件 function dbClickEvent() { clearTimeout(timer) // some code }