How to allow an animation to complete without being interupted?
<p>I'm having a problem with jQuery and the switchclass function. I'm using the serialscroll function to navigate my site and have bound the arrow keys for this. I've bound the down arrow key to select/deselect an element by animating between classes. However the problem I'm having is that if the user quickly presses left or right after pressing the down arrow, it doesn't allow the animation to complete and becomes stuck.</p>

<pre><code>function    mainselect()
        {

        setTimeout(function()
            {

            $(".selectstyle" ).switchClass( "selectstyle", "select", 200);
            $(".select" ).switchClass( "select", "selectstyle", 200);
            $(".maincontentshrink" ).switchClass( "maincontentshrink", "maincontent", 200);
            $(".maincontent" ).switchClass( "maincontent", "maincontentshrink", 200);
            return false;
            },
            250);

        }
$(document).keydown(function(e)                     //keyboard bind 
    {
    if( e.keyCode == 39 )                       //right (-&gt;)
        {   
        setTimeout(function()
            {
    //      $(".maincontent" ).switchClass( "maincontent", "maincontent", 200 );
            $(".maincontentshrink" ).switchClass( "maincontentshrink", "maincontent", 200 );
            $(".selectstyle" ).switchClass( "selectstyle", "select", 200 );
            $pane.trigger('next');
            return false;
            },
            200);
        }
    });


$(document).keydown(function(e)
    {   
    if( e.keyCode == 37 )                       //left (&lt;-)
        {   
        setTimeout(function()
            {
    //      $(".maincontent" ).switchClass( "maincontent", "maincontent", 200 );
            $(".maincontentshrink" ).switchClass( "maincontentshrink", "maincontent", 200 );
            $(".selectstyle" ).switchClass( "selectstyle", "select", 200 );
            $pane.trigger('prev');
            },
            200);
    }
    }); 

$(document).keydown(function(e)
    {   
    if( e.keyCode == 40 )                       //down (\/) 
        {
        mainselect()

        }
    }); 
</code></pre>

<p>Is there a way to disable other functions or to unbind/bind keypresses until the animation is completed?</p>
