Javascript或jQuery自动调整大小脚本

Javascript or jQuery Autoresize script

本文关键字:脚本 调整 jQuery Javascript      更新时间:2023-09-26

所以在Firefox版本低于7这个脚本工作(它是自动调整浏览器窗口的最大访问者监视器)。现在在FF 7 +中,它似乎不起作用。如果你能找出它不工作的原因,或者如果你能给我一个类似的,我将非常感谢!下面是我的代码:

<script language="JavaScript1.2">
top.window.moveTo(0,0);
if (document.all) {
    top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
    if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
        top.window.outerHeight = screen.availHeight;
        top.window.outerWidth = screen.availWidth;
    }
}
</script>

From the fine manual:

窗口。outerHeight属性是只读的

同样适用于window.outerWidth。有resizeToresizeBy,但浏览器不一定会注意到你卑微的请求。

浏览器窗口的大小是用户选择的,调整窗口的大小有点不礼貌,所以许多浏览器不允许你这样做。