resizeBy()
Anonymous contributor
Published Feb 14, 2025
Contribute to Docs
The resizeBy()
function under the window
object resizes the browser window by a specified number of pixels relative to its current size.
Syntax
window.resizeBy(widthDelta, heightDelta);
widthDelta
: The number of pixels to increase or decrease the window’s width. Positive values increase the width, negative values decrease it.heightDelta
: The number of pixels to increase or decrease the window’s height. Positive values increase the height, negative values decrease it.
Example
In this example, the window size will increase by 100 pixels in width and 50 pixels in height:
window.resizeBy(100, 50);
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn JavaScript on Codecademy
- Career path
Front-End Engineer
Front-end engineers work closely with designers to make websites beautiful, functional, and fast.Includes 34 CoursesWith Professional CertificationBeginner Friendly115 hours - Free course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner Friendly15 hours