How to resize a window using jQuery?

JQuery has an event called resize, with which you can add an event handler when resizing a window, for example.

$(window).resize(function () { // code here }); 

I need to resize the window using the jQuery command; is it possible?

eg. $ (window) .resize (-1, -1); // to reduce / increase the width and height of the window

thanks

+8
jquery resize window
source share
2 answers

Try using this; its pure javascript is not involved in jQuery.

 window.resizeTo(width, height); 
+26
source share

Sorry, it seems to bind the event handler to the JavaScript "resize" event, or to fire this event on an element.

see: http://api.jquery.com/resize/

-3
source share

All Articles