Skip to content

Instantly share code, notes, and snippets.

@jonchretien
Last active December 12, 2015 08:18
Show Gist options
  • Save jonchretien/4742561 to your computer and use it in GitHub Desktop.
Save jonchretien/4742561 to your computer and use it in GitHub Desktop.
/**
* Calculate the height of the document.
* http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
*/
function calculateDocumentHeight() {
var body = document.body,
html = document.documentElement,
height;
height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment