Home  >  Article  >  Web Front-end  >  html中的click事件被触发两次如何解决_html/css_WEB-ITnose

html中的click事件被触发两次如何解决_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:11:511623browse

//1:用中间变量处理
var b=true;
function(){
if(b){
b=false;
//…你的代码块
}
}
//2用jq处理:
$(“#btnbgm”).one(“click”,function(){
_click($(this));
});
function _click(obj){
//你的代码块
settimeOut(function(){
$(“#btnbgm”).one(“click”,function(){
_click(obj);
});
},500);
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn