Color Animation
jQuery UI effects core adds the ability to animate color properties using rgb()
,
rgba()
, hex values, or even color names such as "aqua"
. Simply include the
jQuery UI effects core file and .animate()
will gain support for colors.
The following properties are supported:
backgroundColor
borderBottomColor
borderLeftColor
borderRightColor
borderTopColor
color
columnRuleColor
outlineColor
textDecorationColor
textEmphasisColor
Support for color animation comes from the jQuery Color plugin. The Color plugin provides several functions for working with colors. For full documentation, please see the jQuery Color documentation.
link Class Animations
While there are use cases for directly animating individual color properties, it
is often a better approach to contain the styles in a class. jQuery UI provides
a few methods which will animate the addition or removal of a CSS class,
specifically .addClass()
, .removeClass()
,
.toggleClass()
, and .switchClass()
. These
methods will automatically determine which properties need to change and apply
the appropriate animations.
link Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
|