【发布时间】:2012-08-17 12:28:53
【问题描述】:
我正在使用 Moodle:
我正在尝试从框架内运行一些 Javascript 来获取浏览器窗口的高度,因此如果用户使用的浏览器尺寸不够理想,我可以提醒他们。
我试过这样的事情:
window.top.document.body.offsetHeight
document.documentElement.clientHeight
$(document).height()
$(window).height()
但它们都给出了静态高度,当我调整浏览器大小时,它们永远不会改变。
哦,它必须在 IE8 中工作。
【问题讨论】:
-
which never change when I resize the browser....这是一个响应式架构,您需要在$(window).on('resize', function(){ console.log($(window).height()); });的范围内 -
我的意思是,在刷新浏览器之间。我已经设置了一个警报来告诉我负载的高度。
标签: javascript jquery height