JavaScript window.resizeBy() Method
You are Here:
JavaScript window.resizeBy() Method
The window.resizeBy()
method resizes the current window by a specified amount relative to its current size.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<button onclick="myOpen()">Open Window</button>
<button onclick="myResizeBy()">ResizeBy Window</button>
<script>
var myWindow;
function myOpen(){
myWindow = window.open("","myWindow","width=100, height=150");
}
function myResizeBy(){
myWindow.resizeBy(50, 75);
myWindow.focus();
}
</script>
</body>
</html>
Syntax
window.resizeBy(width, height)
Parameter Values
Value | Type | Explanation |
---|---|---|
width | Required | The number of pixels to grow the window horizontally. |
height | Required | The number of pixels to grow the window vertically. |
resizeBy() vs resizeTo()
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<button onclick="myOpen()">Open Window</button>
<button onclick="myResizeBy()">ResizeBy Window</button>
<button onclick="myResizeTo()">ResizeTo Window</button>
<script>
var myWindow;
function myOpen(){
myWindow = window.open("","myWindow","width=100, height=150");
}
function myResizeBy(){
myWindow.resizeBy(50, 75);
myWindow.focus();
}
function myResizeTo(){
myWindow.resizeTo(400, 400)
myWindow.focus();
}
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.