弹出窗口最大化按钮
如何使用Javascript启用弹出窗口的最大化和恢复按钮?
How to enable the maximize and restore button of the popup window using Javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何使用Javascript启用弹出窗口的最大化和恢复按钮?
How to enable the maximize and restore button of the popup window using Javascript?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
您必须打开这样的弹出窗口:
技巧是使窗口可调整大小。搜索 window.open() 函数文档。
You have to open a popup like this:
The trick is to make the window resizable. Search for the window.open() function documentation.
使用我粘贴在底部的代码,您可以通过在网站界面中创建这些按钮来模拟这些按钮。
最大化:使用
Namespace.outerPositionGet()
保存当前位置,使用Namespace.outerSizeGet()
保存当前位置,然后执行Namespace.outerPositionSet({left:0, top:0})
和Namespace.outerSizeSet({width:window.screen.availWidth, height:window.screen.availHeight})
。恢复:只需设置最大化时保存的位置和大小即可。
Using the code I pasted on the bottom, you can emulate these buttons by creating them in your website interface.
To maximise: save the current position with
Namespace.outerPositionGet()
and size withNamespace.outerSizeGet()
, then doNamespace.outerPositionSet({left:0,top:0})
andNamespace.outerSizeSet({width:window.screen.availWidth, height:window.screen.availHeight})
.To restore: just set position and size which were saved when maximising.
我假设您正在谈论警报弹出窗口?这是标准 JavaScript 无法完成的。
最好的解决方案是尝试使用为各种 JavaScript 框架(例如 jQuery)开发的许多弹出解决方案中的一些,并看看是否可以根据您的特定用途进行定制。
I'm assuming you're talking about the alert popup? This can't be done with standard JavaScript.
You best solution would be to try using some of the many popup solutions that have been developed for the various JavaScript frameworks (e.g. jQuery), and seeing if you can tailor this to your particular use.
也试试这个。它对我有用......
try this also. its working for me...
抱歉,你不能——至少不能普遍如此。弹出窗口取决于实现,并且没有任何标准 JavaScript 方法可以按照您描述的方式控制它。
You can't, sorry - at least, not universally. The popup is implementation-dependent and there aren't any standard JavaScript methods for controlling it in the manner you describe.