Created
July 17, 2016 09:26
-
-
Save ryanlid/9fcbec58057d20aefd397da76a7db9f7 to your computer and use it in GitHub Desktop.
获取浏览器高度
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert($(window).height()); //浏览器时下窗口可视区域高度 | |
alert($(document).height()); //浏览器时下窗口文档的高度 | |
alert($(document.body).height());//浏览器时下窗口文档body的高度 | |
alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin | |
alert($(window).width()); //浏览器时下窗口可视区域宽度 | |
alert($(document).width());//浏览器时下窗口文档对于象宽度 | |
alert($(document.body).width());//浏览器时下窗口文档body的高度 | |
alert($(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度 包括border padding margin | |
alert($(document).scrollTop()); //获取滚动条到顶部的垂直高度 | |
alert($(document).scrollLeft()); //获取滚动条到左边的垂直宽度 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment