Android 2.1 地址栏导致视口尺寸发生变化

发布于 2024-09-02 12:58:17 字数 364 浏览 4 评论 0原文

我有一个页面,其中有 100% 宽度和高度 div(所有周围元素的大小都相应调整,以便它实际上实现 100% 宽度和高度)。在该 div 下方,我有第二个具有固定高度的 div。

在移动 safari 和黑莓中,一切都很好,当页面加载时,尺寸会正确应用(顶部 div 填充视口),并且用户可以向下滚动以显示第二个 div。 Android 2.1 也能正确应用尺寸,但有一个额外的怪癖;当用户向下滚动并从页面中删除地址栏时,会重新计算 div 的尺寸以填充视口,从而导致内容跳转。理想情况下,我希望 div 的尺寸在页面滚动时保持静态,但保持 100%,以便无论设备大小或方向如何,它都会填充视口。

有谁知道有什么方法可以禁用这种重新计算吗?

感谢您提供的任何帮助。

I have a page that has a 100% width and height div in it (all surrounding elements are sized accordingly so that it does actually achieve 100% width and height). Below that div I have a second div with a fixed height.

In mobile safari and blackberry everything is fine, when the page loads the dimensions are applied correctly (the top div filling the viewport) and the user can scroll down to reveal the second div. Android 2.1 also applies the dimensions correctly, but with an added quirk; when the user scrolls down and removes the address bar from the page, the dimensions of the div are recalculated to fill the viewport, causing the content to jump. Ideally I would like the dimensions of the div to remain static when the page is scrolled, but remain 100% so that it will fill the viewport regardless of device size or orientation.

Does anyone know of any way to disable this recalculation?

Thanks for any help you can provide.

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

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

发布评论

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

评论(1

踏月而来 2024-09-09 12:58:17

我唯一能想到的就是在地址栏计数器上设置一个 Android 2.1 特定的负边距。通过用户代理来定位它。

The only thing I can think of is to have a Android 2.1 specific negative margin the counters the address bar. Target it by user agent.

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