Well, the most “oldschool” way would be to set a var as a “flag” to track when the transition is in progress, and only toggle the class if it is not. When you toggle the class name, make this
transitioning status flag
true. You can listen for the
transitionend event (using jQuery’s
one() method, just like in the example @Paulie_D linked to), and set the flag back to
false when the transition is done.