The Light
The Light

Reputation: 27011

How to resize a window using JQuery?

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

Upvotes: 10

Views: 45320

Answers (2)

Kevin Burton
Kevin Burton

Reputation: 11936

sorry looks like that binds an event handler to the "resize" JavaScript event, or trigger that event on an element.

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

Upvotes: -3

ShankarSangoli
ShankarSangoli

Reputation: 69905

Try to use this, its a pure javascript no JQuery involved.

window.resizeTo(width, height);

Upvotes: 27

Related Questions