如何使用JQuery调整窗口大小? [英] How to resize a window using JQuery?

查看:120
本文介绍了如何使用JQuery调整窗口大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JQuery有一个名为resize的事件,您可以使用该事件在调整窗口大小时添加事件处理程序.

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
});

我需要使用JQuery命令调整窗口大小;有可能吗?

What I'd need is to resize the window using a JQuery command; would that be possible?

例如$(window).resize(-1,-1); //减小/增加窗口的宽度和高度

e.g. $(window).resize(-1, -1); // to decrease/increase the width and height of the window

谢谢

推荐答案

尝试使用它,它是纯JavaScript而不涉及JQuery.

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

window.resizeTo(width, height);

这篇关于如何使用JQuery调整窗口大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆