I used the disabled approach once. Another option is a global
variable, sort of a semaphore/mutex.
All the bound function first check:

if( disabledEvents ) return false;

Another option is using event delegation. If you bind only one
function, you can easily unbind/rebind it, OR bind another function to
a descendant that does this:

$().bind( 'some_event', function( e ){
   if( disabledEvents )
       e.stopPropagation().
});

This is pretty much like the other approach, but you separate the
action from the check.

Cheers

--
Ariel Flesler
http://flesler.blogspot.com

On Aug 27, 10:12 am, Keith Hughitt <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I was wondering if anyone had any suggestions as to a method to
> temporarily disable/prevent certain events from firing once one event
> is fired? E.g. when pressing one button, I want to disable all other
> button presses until an animation has finished.
>
> One idea is to temporarily add some class (e.g. "disabled") to each
> other button, and remove it once the animation is done. There are
> probably better ways than this, however.
>
> Any ideas?
>
> Thanks,
> Keith

Reply via email to