ウィンドウresizeBy()
例1
新しいウィンドウを開き、幅と高さのサイズを変更(拡大)します。
function openWin() {
myWindow = window.open("", "", "width=100, height=100");
}
function resizeWin() {
myWindow.resizeBy(250, 250);
}
以下のその他の例。
定義と使用法
このresizeBy()
メソッドは、指定された量だけウィンドウのサイズを変更します。
構文
resizeBy(width, height)
パラメーター
Parameter | Description |
width | Required. A positive or a negative number. The number of pixels to resize the width by. |
height | Required. A positive or a negative number. The number of pixels to resize the height by. |
戻り値
なし |
その他の例
新しいウィンドウを開き、幅を50ピクセル減らし、高さを50ピクセル増やします。
myWindow.resizeBy(-50, 50);
resizeTo()でresizeBy()を使用する:
function resizeWinTo() {
myWindow.resizeTo(800, 600);
myWindow.focus();
}
function resizeWinBy() {
myWindow.resizeBy(-100, -50);
}
ブラウザのサポート
resizeBy()
すべてのブラウザでサポートされています:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |