Metodat fadeOut dhe fadeIn në jQuery

Metodat fadeOut dhe fadeIn implementojnë zhdukjen dhe shfaqjen e butë të elementit.

Le të marrim kodin HTML vijues:

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

Për këtë kod është shkruar CSS vijues:

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

Tani le të implementojmë metodat fadeOut dhe fadeIn:

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

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