jQuery Effects fadeTo() method
Example
Gradually change the opacity of all
elements:
$
(
"
button
"
)
.
click
(
function
(
)
{
$
(
"
p
"
)
.
fadeTo
(
1000
,
0.4
)
;
}
)
;
Try it »
Definition and Usage
The fadeTo() method gradually changes the opacity of the selected elements to a specified value (a fading effect).
Syntax
$(
selector
).fadeTo(
speed,opacity,easing,callback
)
| Parameters | Description |
|---|---|
| speed | Required. Specifies the speed of the fading effect.
Possible values: |
Possible values:
- "swing" - Moves slowly at the beginning/end, and faster in the middle
- "linear" - Moves at a constant speed
To learn more about callback, please visit our jQuery Callback chapter on callbacks.
|More examples
fadeTo() - Using the callback parameter
How to use the callback parameter when fading elements in and out.
jQuery effects methods