一下代碼可以解決單擊事件和雙擊事件衝突的問題
//單擊事件
var timeoutID = null; $("#test).on('click',function(e){ clearTimeout(timeoutID); timeoutID = window.setTimeout(function (){ //寫單擊事件要乾的事 },300); });
//雙擊事件
$("#test).on('dblclick',function(e){
clearTimeout(timeoutID);
//寫雙擊事件要乾的事
});