试图限制窗口大小调整。怎么办呢?

发布于 2024-08-19 21:56:17 字数 174 浏览 6 评论 0原文

我正在尝试设置缩小浏览器窗口大小的限制。如果调整大小低于此限制,我设法调整到所需的大小,但它仅适用于 FF(不适用于 IE 和 Chrome)。

我的问题是:

  1. 限制调整大小的最佳方法是什么?
  2. 为什么 resizeTo 在 Chrome 和 IE 上不起作用?

I'm trying to set a limitation for down sizing the browser window. I managed to resize to desirable size if resizing under this limit, but it only works in FF(not in IE and Chrome).

My questions are:

  1. What's the best way for limiting resizing?
  2. Why doesnt resizeTo does not work on Chrome and IE?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

护你周全 2024-08-26 21:56:17

限制调整大小的最佳方法是什么?

无法完成,抱歉。调整浏览器窗口的大小完全超出您的控制范围。老实说我很惊讶它在 FF 中有效。您使用什么代码?

您唯一能做的就是监听文档大小(或添加resize处理程序),并在文档的边界内做出相应的反应。例如,如果用户将窗口大小调整到低于特定边界,您可以隐藏页面并显示警告消息。不过,我对此会很小心——PC 世界中可能仍然存在 640x480 显示器的特殊情况,而移动客户端目前的平均分辨率约为 480x320。

What's the best way for limiting resizing?

Can't be done, sorry. Resizing the browser window is completely out of your control. I'm astonished honestly that it works in FF. What code do you use for that?

The only thing you can do is listen to the document size (or add a resize handler), and react accordingly within the boundaries of your document. You could for example hide the page, and display a warning message, if the user resizes the window below certain boundaries. I would be careful with this, though - there may be special cases of 640x480 displays still around in the PC world, and mobile clients have an average resolution of somewhere around 480x320 at the moment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文