Temporarily Disallow JQuery Toggle
<p>I have a menu that is <strong>toggled</strong> when a user selects a link. The menu had <strong>different</strong> show and hide <strong>animations</strong> attached, and I want to <strong>prevent</strong> toggling while the animation is running. The following snippet works, but flips the state of <strong>toggle</strong> if the link is clicked quickly twice (i.e. if the user clicks the link quickly twice, the next click will trigger the same action):</p>

<pre><code>&lt;a href="" id="button"&gt;Menu&lt;/a&gt;
&lt;div id="menu"&gt;...&lt;/a&gt;

&lt;script&gt;
$("#button").toggle(
    function (e) { 
      if $("#menu").is(":animated")) return false;
      $("#menu").show("drop", {}, "slow"); 
    }, 
    function (e) { 
      if ("#menu").is(":animated")) return false;
      $("#menu").hide("bounce", {}, "slow"); 
    }
);
&lt;/script&gt;
</code></pre>

<p>How can I prevent switching states within toggle?</p>

<p>Thanks.</p>
