Description
The .fadeToggle() method displays or hides the matched elements by annimating their opacity.
Note: When called on a visible element, the element's display
style property is set to
none
once the opacity reaches 0. Therefore, the element no longer affects the layout of the page.
v1.4.4
This method has the form:
.fadeToggle(duration,easing,callback)
Parameter | Description |
---|---|
duration | (required) Specifies how long the animation will run. Possible values:
|
easing | (optional) A string indicating which easing function to use for the transition |
callback | (optional) A function to be executed after the animation is completed |
Return Value
This form returns a jQuery object.
Examples
Toggle the opacity of a p element:
$("button").click(function(){
$("p").fadeToggle("slow");
});