我试图在没有浏览器栏高度的情况下获取移动浏览器中的视口(viewport)高度,但我尝试过的所有解决方案都不够。
其他人建议使用下面的方法,但它对我不起作用。滚动时我仍然在窗口底部看到一个空白的白色条
var screenHeight = window.innerHeight;
$('.mobile-nav-wrapper').height(screenHeight)
最佳答案
我相信你要找的是 scrollHeight
The scrollHeight property returns the entire height of an element in pixels, including padding, but not the border, scrollbar or margin.
你可以试试这个:
document.body.scrollHeight
关于javascript - 使用 jquery 在移动浏览器中检索屏幕的视口(viewport)高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38665496/