【发布时间】:2020-01-23 19:22:44
【问题描述】:
我尝试了window.open() 和resizeTo(screen.width,screen.height),但它没有以最大化视图打开。
请帮助提供相关代码。
【问题讨论】:
-
你能分享更多你的代码吗?我想看看你正在使用的方法。
标签: javascript jquery html
我尝试了window.open() 和resizeTo(screen.width,screen.height),但它没有以最大化视图打开。
请帮助提供相关代码。
【问题讨论】:
标签: javascript jquery html
您只能resizeTo() 由window.open() 创建的窗口。首先,您应该创建并写入任何 var 您的窗口实例。之后你可以使用它的方法。这是一个例子:
myExternalWindow = window.open("http://myurl.domain", "myWindowName", "resizable");
myExternalWindow.resizeTo(screen.availWidth,screen.availHeight);
祝你好运!
【讨论】:
尝试使用 screen.availHeight / screen.availWidth 的 window.open。
例如
window.open(src, "newWin", "width="+screen.availWidth+",height="+screen.availHeight)
【讨论】:
您将打开的窗口(我认为您的意思是弹出窗口)的大小可以通过 width 和 height 属性设置,如下所示:
<a href="your-http-address.php" onclick="window.open(this.href,'targetWindow',
'toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
width=your_width,
height=your_height');
return false;">Open PopUp Window</a>
占位符 your_width 和 your_height 指定弹出窗口的尺寸。要使弹出窗口覆盖整个屏幕尺寸,只需使用 screen.availWidth 和 screen.availHeight。
【讨论】: