使用jQuery,如何在当前选项卡上禁用单击效果?

我有一个动画菜单,但我想在动画发生时禁用点击。

$("div").click(function() { $(this).animate({height: "200px"}, 2000); return false; });

但是,我想在事件发生时禁用所有按钮,并禁用单击的div。

我正在考虑将一个类添加到被点击的div中,并将点击仅放在没有该类的div上:

 $("div").not("clicked").click(function() { $(this).animate({height: "200px"}, 2000).addClass("clicked"); return false; }); 

但这似乎不起作用(我认为它在逻辑上)?

任何帮助赞赏。

干杯,
史蒂夫

 $("div").click(function() { if (!$(this).parent().children().is(':animated')) { $(this).animate({height: "200px"}, 2000); } return false; }); 

你可以这样做……

 $(function() { $("div").click(function() { //check to see if any of the divs are animating if ($("div").is(":animated")) { alert("busy"); return; } //whatever your animation is var div = $(this); div.slideUp(3000, function(){ div.slideDown(1000); }); }); }); 

只要任何div当前没有动画,这将为点击设置动画。 我很可能将所有这些div放在一个容器中而不只是简单地引用div,因为它可能会影响页面上的菜单,而不仅仅是菜单,

如何在动画发生后禁用单击的

? 我已经将一个类添加到已被单击的div中,但执行以下操作似乎不起作用:

 
$("div").not('active').click(function() { if (!$(this).parent().children().is(':animated')) { $(this).animate({height: "200px"}, 2000); } return false; });

我怀疑我错过了一些关于道路的东西。不起作用