使用jQuery,如何禁用当前选项卡上的单击效果? [英] Using jQuery, how do I disable the click effect on the current tab?
本文介绍了使用jQuery,如何禁用当前选项卡上的单击效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个动画菜单,但我想在动画发生时禁用点击。
I have a menu with an animation going on, but I want to disable the click while the animation is happening.
<div></div>
<div></div>
<div></div>
$("div").click(function() {
$(this).animate({height: "200px"}, 2000);
return false;
});
但是,我想在事件发生时禁用所有按钮,并禁用div点击。
However, I want to disable all the buttons while the event is happening, AND disable the div that was clicked.
我正在考虑在点击的div中添加一个类,只将点击放在没有该类的div上:
I was thinking of adding a class to the div that's clicked and putting the click only on the divs without that class:
$("div").not("clicked").click(function() {
$(this).animate({height: "200px"}, 2000).addClass("clicked");
return false;
});
但这似乎不起作用(我认为它在逻辑上是这样的)?
But this doesn't appear to work (I think it does logically)?
任何帮助表示赞赏。
干杯,
Steve
Cheers,
Steve
推荐答案
$("div").click(function() {
if (!$(this).parent().children().is(':animated')) {
$(this).animate({height: "200px"}, 2000);
}
return false;
});
这篇关于使用jQuery,如何禁用当前选项卡上的单击效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文