Home  >  Article  >  Web Front-end  >  Usage examples of fadeOut() method in jQuery_jquery

Usage examples of fadeOut() method in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 16:24:491294browse

The example in this article describes the usage of fadeOut() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method fades out all matching elements through a change in opacity, and optionally triggers a callback function after the animation is complete.

Usage of fadeOut() method:

This method can specify the duration of the animation effect. For example:

Copy code The code is as follows:
$("div").fadeOut(5000)

The above code stipulates that the fade-out effect of the div can be completed within 5000 milliseconds (5 seconds).
This method can also trigger a callback function after the animation is completed. For example:

Copy code The code is as follows:
$("div").fadeOut(5000,function(){alert(' Animation effect completed! ')})

The above code can trigger the callback function after the animation is completed, so a prompt box will pop up.
Example code:

Copy code The code is as follows:






fadeOut() function-Script Home









The above code can slowly set the div to transparent effect by clicking the button. After it is completely transparent, then specify the callback function.

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn