jQuery resize()メソッド

❮jQueryイベントメソッド

ブラウザウィンドウのサイズが変更された回数を数えます。

$(window).resize(function(){
  $('span').text(x += 1);
});

定義と使用法

サイズ変更イベントは、ブラウザウィンドウのサイズが変更されたときに発生します。

resize()メソッドは、サイズ変更イベントをトリガーするか、サイズ変更イベントが発生したときに実行する関数をアタッチします。


構文

選択した要素のサイズ変更イベントをトリガーします。

$(selector).resize()

サイズ変更イベントに関数をアタッチします。

$(selector).resize(function)

Parameter Description
function Optional. Specifies the function to run when the resize event is triggered

❮jQueryイベントメソッド