jQuery Effect - fadeOut() Method
Example
Use the fade out effect to hide a <p> element:
$(".btn1").click(function(){ $("p").fadeOut(); });
Definition and Usage
The fadeOut() method uses the fade out effect to hide the selected element, if the element is hidden.
Syntax
$(selector).fadeOut(speed,callback)
Parameter | Description |
---|---|
speed |
Optional. Specify the speed of the element from visible to hidden. The default is "normal". Possible values:
In the case of setting the speed, the element will gradually change its opacity during the process from visible to hidden (which will create a fade out effect). |
callback |
Optional. The function to be executed after the fadeOut function is executed. For more information about callback, please visit our jQuery Callback chapter. You cannot set this parameter unless speed is set. |
Tips and Comments
Tip:If the element is already hidden, the effect does not produce any change unless the callback function is specified.
More examples
- Use the speed parameter
- Use the speed parameter to control the fade in or fade out of elements.