Description
The .fadeTo() method gradually changes the opacity, for selected elements, to a specified opacity (fading effect).
v1.0
This method has the form:
.fadeTo(duration,opacity,callback)
Parameter | Description |
---|---|
duration | (required) Specifies the speed of the fading effect. Possible values:
|
opacity | (required) Specifies the opacity to fade to. Must be a number between 0.00 and 1.00 |
callback | (optional) A function to be executed after the fadeTo() method is completed |
Return Value
This form returns a jQuery object.
v1.4.3
This method has the alternate form:
.fadeTo(duration,opacity,easing,callback)
Parameter | Description |
---|---|
duration | (optional) Specifies the speed of the fading effect. Possible values:
|
opacity | (required) Specifies the opacity to fade to. Must be a number between 0.00 and 1.00 |
easing | (optional) A string indicating which easing function to use for the transition. |
callback | (optional) A function to be executed after the fadeTo() method is completed |
Return Value
This form returns a jQuery object.
Examples
Gradually change the opacity of a p element:
$("button").click(function(){
$("p").fadeTo(1000,0.4);
});