Achieve the fade-in effect of all matching elements through changes in opacity, and can be used after the animation is completed Optionally trigger a callback function.
This animation only adjusts the opacity of the element, which means that the height and width of all matching elements will not change.
Slowly fade the paragraph in for 600 milliseconds:
$("p").fadeIn("slow");
##fadeOut( speed, [callback] )
Achieve the fade-out effect of all matching elements through changes in opacity, and optionally trigger a callback function after the animation is completed.
Slowly fade out the paragraph in 600 milliseconds:
$("p").fadeOut("slow");
##fadeTo(speed, opacity, [callback] )Gradually adjusts the opacity of all matching elements to the specified opacity, and optionally triggers a callback function after the animation completes.
Slowly adjust the transparency of the paragraph to 0.66 over 600 milliseconds, about 2/3 visibility:
jQuery fadeIn() is used to fade in hidden elements.
语法:$(selector).fadeIn(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds. The optional callback parameter is the name of the function to be executed after fading is completed.
The following example demonstrates the fadeIn() method with different parameters:
The jQuery fadeOut() method is used to fade out visible elements.
语法:$(selector).fadeOut(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds. The optional callback parameter is the name of the function to be executed after fading is completed. The following example demonstrates the fadeOut() method with different parameters:
The jQuery fadeToggle() method can switch between the fadeIn() and fadeOut() methods. If the element is already faded out, fadeToggle() adds a fade-in effect to the element. If the element is already faded in, fadeToggle() adds a fade out effect to the element.
语法:$(selector).fadeToggle(speed,callback);
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds. The optional callback parameter is the name of the function to be executed after fading is completed. The following example demonstrates the fadeToggle() method with different parameters:
4. jQuery fadeTo() method The jQuery fadeTo() method allows gradients to be A certain opacity (value between 0 and 1).
语法:$(selector).fadeTo(speed,opacity,callback);
The required speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds. The required opacity parameter in the fadeTo() method sets the fade effect to the given opacity (a value between 0 and 1). The optional callback parameter is the name of the function to be executed when the function completes. The following example demonstrates the fadeTo() method with different parameters:
After using fadeTo to set the popup layer transparency, using fadeIn will cause the object to display and fade to the fadeTo setting. Transparency.What is introduced here is only the characteristics of the two functions. In actual applications, they do not necessarily need to be used together.
The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~
Students who have watched this course are also learning