我尝试了以下命令来确定视口(viewport)高度:
var H1 = document.documentElement.clientHeight,
H2 = $(window).height();
所有情况的结果都是 8。但视口(viewport)要大得多(> 500)。
补充:
区别在于
H = $(document).height()
H1 = $(window).height()
使用 Firefox 浏览器 (24.0/Debian)。 H = 600 H1 = 8 使用 Chromium (29.0/Debian) H = 600 H1 = 600
不知道为什么。
最佳答案
如果有边距或填充,您应该查看 $(window).outerHeight()
。
更多信息here
关于javascript - $(window).height() 返回奇怪的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19135089/