jQuery Tutorial Tutorials - jQuery .fadeTo()

jQuery .fadeTo()

The .fadeTo() method in jQuery is used to adjust the opacity of the matched elements.

jQuery .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

jQuery .fadeTo() Examples

example

Animates first paragraph to fade to an opacity of 0.5 slowly.

$( "p:first" ).fadeTo( "slow" , 0.5, function() {
// Animation complete.
});

Try now

Date:2019-08-30 02:08:29 From:www.Lautturi.com author:Lautturi