Window resizeBy() method

Definition and Usage

resizeBy() The method adjusts the window size by the specified amount.

See also:

resizeTo() method

moveBy() method

moveTo() method

Instance

Example 1

Open a new window and adjust (increase) the width and height:

function openWin() {
  myWindow = window.open("", "", "width=100, height=100");
}
function resizeWin() {
  myWindow.resizeBy(250, 250);
}

Try it yourself

Example 2

Open a new window, decrease the width by 50px, and increase the height by 50px:

myWindow.resizeBy(-50, 50);

Try it yourself

Example 3

Combine resizeBy() with resizeTo():

function resizeWinTo() {
  myWindow.resizeTo(800, 600);
  myWindow.focus();
}
function resizeWinBy() {
  myWindow.resizeBy(-100, -50);
}

Try it yourself

Syntax

resizeBy(width, height)

Parameter

Parameter Description
width Mandatory. Positive or negative number. The number of pixels to adjust the width size.
height Required. A positive or negative number. The number of pixels to adjust the height size.

Return Value

None.

Browser Support

All Browsers Support resizeBy():

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support