如果用户点击次数过多,如何停止.click
功能?
我的代码:
$('button').click(function() {
$('#bg').fadeToggle('200');
});
最佳答案
点击超过5次后将停止执行该功能:http://jsfiddle.net/1dc8u7ms/1/
var counter = 0;
$('button').click(function() {
if(counter > 5){return};
$('#bg').fadeToggle('200');
return counter++;
});
关于javascript - 如果用户点击多次,则停止 .click 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28049774/