jQuery绑定多次激活? [英] jQuery bind firing multiple times?
本文介绍了jQuery绑定多次激活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(".container").on("contextmenu", ".photos-bottom .albums li", function(e) {
$('html').bind('click', function (event) {
alert(id);
});
return false;
});
当我右键单击(对于contextmenu)多次然后左键单击html一次,它会触发提示我右键点击的次数。
when I right click (for the contextmenu) multiple times and then left click html once, it triggers the alert the number of times that I right clicked.
因此,如果我右键单击一次,然后左键单击,它会显示一次弹出窗口。
如果我右键单击三次,然后左键单击,它会显示三次弹出窗口。
So if I right click once, then left click, it shows a popup once. If I right click three times, then left click, it shows the popup three times.
为什么会这样?
推荐答案
$('html')。unbind('click')。bind('click')
修好了。
这篇关于jQuery绑定多次激活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文