views:

59

answers:

2

Hello, can I make animation from one class to another?

I found animate function, but it takes only css-parameters, not css-styles. For example, I want something like this:

$(this).animate( 'StyleTo', 'slow' );

Thanks.

+1  A: 

no you cannot animate from a class to a class in base jQuery without using a plugin.

Scott Evernden
A: 

You can have this effect by using jQueryUI: see: jQueryUI animate to class
or see: http://james.padolsey.com/demos/animateToSelector/

But:
unfortunately this is only if you want to apply this transition to the parent level, but it wont effect the children styles (to animate them as they are (slowly) becoming a new child/grandchild of the new class).

for instance, if you want to animate the switching from list to grid, this wont help you, since it will only animate to parents styles to its own new styles, not its children.

There are some really advanced solutions to extend this jQueryUI animate to class functionality, that it should loop all the children style changes and animate them as well to the its new class styles.

adardesign