Last active
August 29, 2015 14:21
-
-
Save DmitryMyadzelets/bc2a0c08a654825943a4 to your computer and use it in GitHub Desktop.
Some function for web page view analysis
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
// Returns entire web page height | |
function page_height () { | |
return Math.max( | |
document.body.scrollHeight, document.documentElement.scrollHeight, | |
document.body.offsetHeight, document.documentElement.offsetHeight, | |
document.body.clientHeight, document.documentElement.clientHeight | |
); | |
} | |
// Returns visible web page height | |
function view_height () { | |
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | |
} | |
// Returns ofsset of the visible web page from the top | |
function view_offset () { | |
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment