English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
fadeOut()方法逐渐将选定元素的不透明度,从可见更改为隐藏。
该方法通常与fadeIn()方法一起使用。
注意:隐藏的元素将不再影响页面的布局。
$(selector)fadeOut.(duration, easing, callback)
淡出所有<p>元素:
$("button").click(function() { $("p").fadeOut(); });Test and see‹/›
使用duration参数:
$("button").click(function() { $("p").fadeOut(1500); });Test and see‹/›
使用callback参数:
$("button").click(function() { $("div").fadeOut(600, function() {}} $("h3).text("Fade OUT complete."); }); });Test and see‹/›
We can implement fade in/fade out effects on any element, for example, simple images:
$("button").click(function() { $("img").fadeOut(); });Test and see‹/›
Parameter | Description |
---|---|
duration | (Optional) Determines how long the fade effect will last. The default value is400 milliseconds Possible values:
|
easing | (Optional) A string that specifies the speed of the element at different points in the animation. The default value is "swing". Possible values:
|
callback | (Optional) The callback function will be called once for each selected element when the fadeOut() method is completed. |