Created
June 2, 2013 10:44
-
-
Save hiro3/5693272 to your computer and use it in GitHub Desktop.
BackCompat = Back Compatible = 後方互換モードだとdocument.bodyをみないと値が取れないためrootを設定。
This file contains 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
var root = (document.compatMode === "BackCompat") ? document.body : document.documentElement; | |
console.log([ | |
root.clientHeight,//height of the visible area | |
root.clientWidth,//width of the visible area | |
root.scrollHeight,//document height including hidden(scroll) area | |
root.scrollWidth,//document width including hidden(scroll) area | |
window.pageYOffset || root.scrollTop, | |
window.pageXOffset || root.scrollLeft, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment