jQuery resize() メソッド

❮ jQuery Event メソッド

ブラウザ・ウィンドウが何度リサイズされたかを数える:

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

定義と用法

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

resize() メソッドは、resize イベントをトリガするか、または resize イベントが発生するときに実行する関数を接続します。


構文

選択した要素の resize イベントをトリガする:

$(selector).resize() Try it

reisize イベントに関数を接続する:

$(selector).resize(function) Try it

パラメータ 説明
function 任意。resize イベントがトリガされた時に実行する関数を指定する

❮ jQuery Event メソッド