.fadeTo()
The .fadeTo()
method in jQuery is used to adjust the opacity of the matched elements.
.fadeTo()
syntax.fadeTo(duration,opacity[,complete]); .fadeTo(options) .fadeTo(duration[,easing][,complete]);
Parameter | Type | Description |
---|---|---|
duration |
Number,String | determining how long the animation will run.Default 400ms(normal) fast:200ms slow:600ms |
opacity |
Number | opacity value between 0 and 1 |
complete |
Function | A function to call once the animation is complete. |
easing |
String | an easing function for the transition. Default swing |
.fadeTo()
ExamplesAnimates first paragraph to fade to an opacity of 0.5 slowly.
$( "p:first" ).fadeTo( "slow" , 0.5, function() { // Animation complete. });