jQuery UI API - Color Animation
The jQuery UI Effects Core adds the ability to dynamically change the color property using rgb()、rgba(), hexadecimal values, or color names such as"aqua" . To use it, simply include the jQuery UI Effects Core file, and.animate() color support will be available.
The following properties are supported:
backgroundColorborderBottomColorborderLeftColorborderRightColorborderTopColorcolorcolumnRuleColoroutlineColortextDecorationColortextEmphasisColor
Support for color animation comes from the jQuery Color plugin. The Color plugin provides several functions for working with colors. For full documentation, visit jQuery Color documentation。
Class Animations
Although the color property can be animated directly, a better approach is usually to include the styles in a class. jQuery UI provides methods for dynamically adding or removing CSS classes, namely .addClass()、.removeClass()、 .toggleClass() and .switchClass(). These methods automatically determine which properties need to change and apply the appropriate animation.
Example
颜色动画(Color Animation)演示
颜色动画