LeBlaireau
LeBlaireau

Reputation: 17467

jQuery - can I animate addClass/removeClass

Is there anyway to do this rather than animate the css properties individually?

Upvotes: 1

Views: 764

Answers (1)

Vince V.
Vince V.

Reputation: 3143

You could use the jQuery UI effects class api:

http://docs.jquery.com/UI/Effects/ClassTransitions

Here do you find more about class transitions.

there is a method called switchClass

switchClass

The switchClass method allows you to visually transition from one class to another. (This functionality is often described as 'animateClass'.)

How to use it ? (example from the page itself)

$(elem).switchClass('currentClass','newClass',500,'easeOutBounce',function(){
  console.log('transition is done!');
});

Upvotes: 3

Related Questions