Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery Effect fadeOut() Method
The fadeout() method in jQuery is used to give a fading effect by changing the opacity for the selected elements. The fading effect changes from visible to hidden.
Syntax
The syntax is as follows −
$(selector).fadeOut(speed,easing,callback)
Above, the parameter speed is the speed of the fading effect. Here, easing is the speed of the element in different points of the animation, whereas callback is a function to be executed after fadeOut() completes.
Example
Let us now see an example to implement the jQuery fadeout() method −
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("h2").fadeOut();
});
});
</script>
</head>
<body>
<h2>Demo Heading</h2>
<button>Click to Fade out</button>
</body>
</html>
Output
This will produce the following output −

Click the button to fade out heading. Now, you can’t see the heading since it faded out i.e. from visible to hidden −

Advertisements