The fadeToggle()
method exposed by jQuery will either fade an element in, or fade it out depending on the current state of the element. Elements that are visible will be faded out, while elements that are hidden will be faded in.
When elements are faded out with fadeToggle()
, they will automatically be set to display:none
at the end of the animation so that the element doesn't affect the layout of the page.