jQuery効果fadeOut()メソッド

❮jQueryエフェクトメソッド

すべての<p>要素をフェードアウトします。

$("button").click(function(){
  $("p").fadeOut();
});

定義と使用法

およびfadeOut()メソッドは、選択した要素の不透明度を表示から非表示に徐々に変更します(フェード効果)。

:非表示の要素はまったく表示されません(ページのレイアウトには影響しなくなりました)。

ヒント:このメソッドは、 fadeIn()メソッドと一緒に使用されることがよくあります。

構文

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

Parameter Description
speed Optional. Specifies the speed of the fading effect. Default value is 400 milliseconds

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element in different points of the animation. Default value is "swing"

Possible values:

  • "swing" - moves slower at the beginning/end, but faster in the middle
  • "linear" - moves in a constant speed
Tip: More easing functions are available in external plugins
callback Optional. A function to be executed after the fadeOut() method is completed

To learn more about callback, visit our jQuery Callback chapter


自分で試してみてください-例


使用速度パラメーターを使用して、フェード効果の速度を指定する方法。


の使用選択した要素の不透明度を徐々に変更するときにコールバックパラメーターを使用する方法。


❮jQueryエフェクトメソッド