Javascript Jquery窗口集宽度
这是我的代码:Javascript Jquery窗口集宽度,javascript,jquery,Javascript,Jquery,这是我的代码: $(function() { checkWindowSize(); function checkWindowSize() { var elWidth = $("#elId").outerWidth(), elHeight = $("#elId").outerHeight(); $(window).innerWidth(elWidth); $(window).innerHeight(e
$(function() {
checkWindowSize();
function checkWindowSize() {
var elWidth = $("#elId").outerWidth(),
elHeight = $("#elId").outerHeight();
$(window).innerWidth(elWidth);
$(window).innerHeight(elHeight);
}
});
每次调用checkWindowSize()函数时,我都要调整浏览器窗口的大小。但我注意到窗口对象的调整大小功能不起作用。
如何调整浏览器窗口的大小?好的,我找到了答案
我的新功能:
function checkWindowSize() {
var elWidth = $("#elId").outerWidth(),
elHeight = $("#elId']").outerHeight(),
browserElements = window.outerHeight - window.innerHeight;
window.resizeTo(elWidth, elHeight + browserElements);
}
只能调整使用
window.open()
动态创建的窗口的大小。在打开多个选项卡的情况下,无法调整窗口的大小。看这是我的情况:窗口被窗口打开。打开。但是我必须根据内容调整它的大小。