Skip to content

Instantly share code, notes, and snippets.

@chrisgoddard
Last active May 2, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisgoddard/cdedd3fa649c777fd90fc3996d9f2bda to your computer and use it in GitHub Desktop.
Save chrisgoddard/cdedd3fa649c777fd90fc3996d9f2bda to your computer and use it in GitHub Desktop.
/**
* 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