English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Metodo fadeOut() di effetto jQuery

jQuery效果方法

Il metodo fadeOut() di jQuery gradually changes the opacity of the selected elements from visible to hidden.

Questo metodo viene solitamente utilizzato confadeIn()Metodi combinati.

Attenzione:Gli elementi nascosti non influenzeranno più la disposizione della pagina.

Sintassi:

$(selector).fadeOut.(durata, easing, callback)

Esempio

Dissolve tutti gli elementi <p>:

$("button").click(function(){
  $("p").fadeOut();
});
测试看看‹/›

使用duration参数:

$("button").click(function(){
  $("p").fadeOut(1500);
});
测试看看‹/›

使用callback参数:

$("button").click(function(){
  $("div").fadeOut(600, function(){
    $("h3").text("Fade OUT complete.");
  });
});
测试看看‹/›

我们可以对任何元素实现淡入淡出效果,例如简单的图像:

$("button").click(function(){
  $("img").fadeOut();
});
测试看看‹/›

参数值

参数描述
duration(可选)确定衰落效果将持续多长时间。预设值为400毫秒

可能的值:

  • 毫秒(例如100、500、2000等)

  • “fast”

  • “slow”

easing(可选)一个字符串,指定在动画的不同点上元素的速度。默认值为“ swing”

可能的值:

  • “swing”-在开始/结束时移动较慢,而在中间移动较快

  • “linear”-以恒定速度移动

callback(可选)fadeOut()方法完成,将调用的函数,每个选定元素调用一次

jQuery效果方法