Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Window resizeBy() method

Window resizeBy() method

Window Object Reference Window Object


Example

Open a new window and reset the width and height of the browser window:

function

openWin

(

)

{

myWindow

=

window

.

open

(

"

"

,

"

"

,

"

width=100, height=100

"

)

;

}

function

resizeWin

(

)

{

myWindow

.

resizeBy

(

250

,

250

)

;

}

Try it »

Definition and Usage

The resizeBy() method is used to adjust the size of the window by the specified number of pixels.

Note: This method defines the number of pixels the bottom-right corner of the specified window moves; the top-left corner is not moved (it stays at its original coordinates).

Syntax

resizeBy(

width,height

)

Parameters Description
width Required. The number of pixels to increase the window's width. Can be a positive or negative value.
height Optional. The number of pixels to increase the window's height. Can be a positive or negative value.

Browser support

All the latest versions of browsers support the resizeBy() method.

Chrome Edge Firefox Safari Opera IE
Supported Supported Supported Supported Supported Supported

Example

Example

Using resizeBy() and resizeTo():

function

resizeWinTo

(

)

{

myWindow

.

resizeTo

(

800

,

600

)

;

myWindow

.

focus

(

)

;

}

function

resizeWinBy

(

)

{

myWindow

.

resizeBy

(

100

, -

50

)

;

}

Try it »


Window Object Reference Window Object