fadeOut and fadeIn methods in jQuery
The fadeOut and fadeIn methods implement a smooth disappearance and appearance of an element.
Let's take the following HTML code:
<button id="hide">hide</button>
<button id="show">show</button>
<div id="elem">text...</div>
The following CSS is written for this code:
#elem {
padding: 10px;
width: 150px;
height: 150px;
border: 1px solid green;
margin-top: 10px;
}
Now we implement the methods fadeOut and fadeIn:
$('#hide').click(function() {
$('#elem').fadeOut(1000);
});
$('#show').click(function() {
$('#elem').fadeIn(1000);
});