.fadeIn() & .fadeOut()

.fadeIn() & .fadeOut() Methods

  • Methods used to display or hide the HTML elements by gradually increasing or decreasing their opacity

.fadeIn()

Example

$(() => {
  $("button").click(() => {
    // fade in #box element; duration 1 sec
    $("#box").fadeIn(1000)
  })
})

JS Bin on jsbin.com


.fadeOut()

Example

$(() => {
  $("button").click(() => {
    // fade out #box element; duration 3 sec
    $("#box").fadeOut(3000)
  })
})

JS Bin on jsbin.com