Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* scroll distance
* pixel distance to bottom of viewport
*/
function depth(){
return (window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || 0) +
(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight)
}
/**
* height of the page in pixels
*/
function pageHeight(){
return Math.max(
document.body.scrollHeight,
document.documentElement.scrollHeight,
document.body.offsetHeight,
document.documentElement.offsetHeight,
document.body.clientHeight,
document.documentElement.clientHeight
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.