Skip to content

Instantly share code, notes, and snippets.

@psiborg
Created January 16, 2012 19:11
Show Gist options
  • Select an option

  • Save psiborg/1622431 to your computer and use it in GitHub Desktop.

Select an option

Save psiborg/1622431 to your computer and use it in GitHub Desktop.
JS Get document height
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment