Easy Tutorial
❮ Jquery Intro Misc Deferred Resolve ❯

jQuery Effect fadeTo() Method

jQuery Effect Methods

Example

Gradually change the opacity of all <p> elements:

$("button").click(function(){
    $("p").fadeTo(1000,0.4);
});

Definition and Usage

The fadeTo() method gradually changes the opacity of the selected elements to a specified value (fade effect).

Syntax

Parameter Description
speed Required. Specifies the speed of the fade effect. Possible values: milliseconds<br> "slow"<br> "fast"
opacity Required. Specifies the transparency to fade to or from. Must be a number between 0.00 and 1.00.
easing Optional. Specifies the speed of the element at different points of the animation. Default value is "swing". Possible values: "swing" - moves slow at the start/end, fast in the middle<br> "linear" - moves at a constant speed. Note: More easing functions are available in extensions.
callback Optional. A function to be executed after the fadeTo() method completes. For more information about callback, visit our jQuery Callback chapter.

More Examples

fadeTo() - Using callback Parameter


jQuery Effect Methods

❮ Jquery Intro Misc Deferred Resolve ❯