Example Animate
# jQuery UI Example β Color Animation
Use `.animate()` to implement color animation effects.
For more details about Color Animation, please refer to the API documentation (#).
jQuery UI bundles the jQuery Color plugin, which provides color animation and many other color-related utility functions.
## Animation Demo
Click the button to preview the effect.
jQuery UI Effects - Animation Demo .toggler { width: 500px; height: 200px; position: relative; } #button { padding: .5em 1em; text-decoration: none; } #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; background: #fff; } #effect h3 { margin: 0; padding: 0.4em; text-align: center; } $(function() { var state = true; $( "#button" ).click(function() { if ( state ) { $( "#effect" ).animate({ backgroundColor: "#aa0000", color: "#fff", width: 500 }, 1000 ); } else { $( "#effect" ).animate({ backgroundColor: "#fff", color: "#000", width: 240 }, 1000 ); } state = !state; }); }); Toggle Effect
(#)
YouTip