27leaves
27leaves

Reputation: 191

jQuery-UI fade subcontainers on toggleClass('.selector',time)

I try to use jquery-ui's addClass/toggleClass function to have a transition between two states. My problem is that I want to fade the subcontainers, too.

Here is an example: http://jsfiddle.net/xhWjP/1/

I want the #blue and #red to be animated, too, not just the #transition block. (on click). Is there already a built-in solution or do I have to code this behaviour by myself?

Thanks!

Upvotes: 2

Views: 193

Answers (1)

binarious
binarious

Reputation: 4588

CSS3 transitions could be used. (Just one of many approaches, I think).

-webkit-transition: all .2s linear; 
-moz-transition: all .2s linear; 
-ms-transition: all .2s linear; 
-o-transition: all .2s linear; 
transition: all .2s linear; 

Demo

Availability: http://caniuse.com/#search=transition

IE 10+, FF 9+, Chrome 17+

Upvotes: 1

Related Questions