English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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().
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‹/›
All browsers fully support the resizeBy() method:
Method | |||||
resizeBy() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
width | Increase the horizontal pixel number of the window |
height | Increase the vertical pixel number of the window |
Return Value: | None |
---|
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‹/›
Window (Window) Reference:resizeTo() Method
Window (Window) Reference:moveTo() Method
Window (Window) Reference:moveBy() Method