ブラウザ・ウィンドウが何度リサイズされたかを数える:
$(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 イベントがトリガされた時に実行する関数を指定する |