Description:
jQuery fadeToggle() method is used to toggle between the fadeIn() and fadeOut() methods. If the selected/matched elements are fadedIn then the fadeToggle will make them faded out.ย And if the selected elements are fadedOut then the fadeToggle will make them fadeIn.
Syntax
.fadeToggle( Ex : $(“#div”).fadeToggle(“slow”);
From the below code, the “divFadeBox” been visible during the page load. After clicking “divButton” ย the click event been triggered and the fadeToggle() will be executed and the box will be disappear. For more explanation see below output section After clicking the “Click to fade Toggleย boxes” button, then the blue box will be disappear if ย it is in visible state else it will be appear if it is in hide like shown below.
Duration/speed
ย It specifies the speed of the fadein. The valuse may be slow, fast and milliseconds. (default value: 400)
Easing
ย It specifies the easing function to be used for transition (default value: swing).
Callback
A function to call once the animation is complete.
Example:
Output:
Leave A Comment