How to resize a window using JQuery?

痴心易碎 提交于 2020-01-20 05:48:24

问题


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


回答1:


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

window.resizeTo(width, height);



回答2:


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/



来源:https://stackoverflow.com/questions/6709408/how-to-resize-a-window-using-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!