简体   繁体   English

如何在jQuery中更改浏览器宽度/高度?

[英]How do I change the browser width/height in jQuery?

Can't figure this out for the life of me. 无法想象我的生活。 Google is no help either. 谷歌也没有帮助。 I'm sure its super easy. 我确信它非常容易。

It's not that easy. 它不是那么容易。 For one thing, this is generally something you should not do. 首先,这通常是你不应该做的事情。 Firefox for example has an option to disable Javascript from resizing the browser. 例如,Firefox可以选择禁用Javascript来调整浏览器的大小。 It's considered anything from a security risk to just a plain annoyanace. 它被认为是从安全风险到简单烦恼的任何事情。

Resizing the browser puts you in the same bucket as poker and "She's waiting for you!" 调整浏览器大小可以让你和扑克一样,“她在等你!” sites. 站点。 Just don't do it. 只是不要这样做。

If you need a window of a specific size, open one of that size with the options to window.open() . 如果需要特定大小的窗口,请使用window.open()选项打开其中一个大小。

Having read all that if you still must do it, use window.resizeTo() . 阅读完所有内容后,如果仍然必须这样做,请使用window.resizeTo()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用输入字段动态更改宽度和高度? - How do I change dynamically the width and height with an input field? 我该如何说“如果宽度&gt;高度”,然后用jQuery“做到这一点”? - How can I say “if width > height” then “do this” with jQuery? 使用jQuery,如何获取图片以全屏显示浏览器的高度和宽度? - Using jQuery, how can I get an image to open full screen to the browser's height and width? 如何在JavaScript中获取浏览器视口的宽度和高度并将其应用于CSS ID? - How Do I Get Browser Viewport Width & Height In Javascript And Apply To CSS ID's? 如何使元素具有页面(文档)的 100% 宽度和高度,而不仅仅是窗口(浏览器)? - How do I make an element 100% width and height of the page (document) and not just the window (browser)? 如何更改画布的宽度或高度? - How do I alter a canvas' width or height? 如何更改图像的高度和宽度 - How do I change the height and width of an image in an <i> tag using CSS? 在将图像加载到页面上之前,如何使用jQuery计算图像的宽度和高度? - How do I calculate the width and height of an image with jQuery, before I load the image on a page? jQuery根据浏览器宽度进行更改 - Jquery To change according to browser width 在调整浏览器宽度时更改高度 - Change li height on browser width resize
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM