鼠标拖动检测
添加一个标识,判断检测鼠标是否移动
var flag = 0; var element = xxxx; element.addEventListener("mousedown", function(){ flag = 0; }, false); element.addEventListener("mousemove", function(){ flag = 1; }, false); element.addEventListener("mouseup", function(){ if(flag === 0){ console.log("click"); } else if(flag === 1){ console.log("drag"); } }, false);