Методи fadeOut и fadeIn в jQuery

Методите fadeOut и fadeIn реализират плавно изчезване и появяване на елемент.

Нека вземем следния HTML код:

html<button id="hide">hide</button>
<button id="show">show</button>
<div id="elem">text...</div>

За този код е прописан следния CSS:

css#elem {
  padding: 10px;
  width: 150px;
  height: 150px;
  border: 1px solid green;
  margin-top: 10px;
}

Сега нека реализираме методите fadeOut и fadeIn:

javascript$('#hide').click(function() {
  $('#elem').fadeOut(1000);
});

$('#show').click(function() {
  $('#elem').fadeIn(1000);
});