English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window resizeBy() method

JavaScript Window Object

resizeBy()method to adjust the size of the current window to the specified size.

This method adjusts the size of the window relative to its current size. To adjust the size absolutely, please usewindow.resizeTo().

Syntax:

window.resizeBy(width, height)
// Function to open a new window
function windowOpen() {
  popupWindow = window.open("", "", "width=150, height=150");
}
// Function to adjust the size of the opened window
function windowResize() {
  popupWindow.resizeBy(200, 200);
  popupWindow.focus();
}
Test and See‹/›

Browser compatibility

All browsers fully support the resizeBy() method:

Method
resizeBy()IsIsIsIsIs

Parameter Value

ParameterDescription
widthIncrease the horizontal pixel number of the window
heightIncrease the vertical pixel number of the window

Technical Details

Return Value:None

More Examples

Open a new window, decrease the width100px, increase the height100px:

function windowResize() {
  popupWindow.resizeBy(-100, 100);
  popupWindow.focus();
}
Test and See‹/›

This example combines resizeBy() with resizeTo():

function windowResizeTo() {
  popupWindow.resizeTo(500, 500);
  popupWindow.focus();
}
function windowResizeBy() {
  popupWindow.resizeBy(100, 100);
  popupWindow.focus();
}
Test and See‹/›

Related References

Window (Window) Reference:resizeTo() Method

Window (Window) Reference:moveTo() Method

Window (Window) Reference:moveBy() Method

JavaScript Window Object