我找了这个,我找到的就是获得窗户的高度。
有没有办法只获得浏览器屏幕的高度?
修改
抱歉英语不好,我是西班牙语。
这就是我正在寻找的:
蓝色+红色是窗口的高度,我只想获得红色部分的高度。
答案 0 :(得分:0)
你的意思是身体的大小吗?
$('body').height();
答案 1 :(得分:0)
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document
答案 2 :(得分:0)
尝试以下
<!doctype html>
<html>
<head>
<title> new document </title>
</head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<body>
<script>
var screenht = screen.height; //This gets the Monitors/Screens height
var docht = $(document).height(); //This gets the view port height
var toolbarht = screenht - docht; //You get the height occupied by browser toolbar
alert('Toolbar Height: '+toolbarht);
</script>
</body>
</html>