如何在移动 Safari 中为 Web 应用计算可视区域的高度(即窗口高度减去地址和书签栏)? [英] How to calculate height of viewable area (i.e., window height minus address & bookmark bars) in mobile Safari for web app?

查看:16
本文介绍了如何在移动 Safari 中为 Web 应用计算可视区域的高度(即窗口高度减去地址和书签栏)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

计算移动 Safari 上有多少可用空间的正确方法是什么?通过查看区域,我们指的是 Web 应用程序实际可用的屏幕数量,即窗口高度减去地址栏和书签栏.

What is the right way to calculate how much viewable space is available on mobile Safari? By viewing area, we mean the amount of the screen actually available to a web app, that is the window height minus the address and bookmark bars.

iOS 7 防止隐藏地址栏,我们需要正确考虑视口高度.

iOS 7 prevents hiding of the address bar, and we need to properly account for the viewport height.

推荐答案

window.innerWidthwindow.innerHeight 将给出视口的宽度和高度.

window.innerWidth and window.innerHeight will give the width and height of the viewport.

这篇关于如何在移动 Safari 中为 Web 应用计算可视区域的高度(即窗口高度减去地址和书签栏)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆