jQuery Effect - Fade
jQuery Fading method
With jQuery, you can achieve the fading effect of elements.
jQuery has the following four fade methods:
fadeIn()
fadeOut()
fadeToggle()
fadeTo()
fadeIn() method
jQuery fadeIn() is used to fade in hidden elements.
Syntax:
$(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.
fadeOut() method
jQuery fadeOut() method is used to fade out visible elements.
Syntax:
$(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 executed after fading is completed.
fadeOut() method
jQuery fadeOut() method is used to fade out visible elements.
Syntax:
$(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 executed after fading is completed.
fadeToggle() method
jQuery fadeToggle() method can switch between fadeIn() and fadeOut() methods.
If the element is already faded out, fadeToggle() will add a fade-in effect to the element.
If the element is already faded in, fadeToggle() will add a fade out effect to the element.
Syntax:
$(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 executed after fading is completed.
php中文网(php.cn)