JQuery has an event called resize using which you can add an event handler when the window is resized e.g.
$(window).resize(function () {
// code here
});
What I'd need is to resize the window using a JQuery command; would that be possible?
e.g. $(window).resize(-1, -1); // to decrease/increase the width and height of the window
Thanks
jQuery resize() MethodThe resize event occurs when the browser window changes size. The resize() method triggers the resize event, or attaches a function to run when a resize event occurs.
In your modern browsers, you can trigger the event using: window. dispatchEvent(new Event('resize'));
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble. In some earlier browsers it was possible to register resize event handlers on any HTML element.
Try to use this, its a pure javascript no JQuery involved.
window.resizeTo(width, height);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With