Skip to content

Instantly share code, notes, and snippets.

@Chalarangelo
Created July 16, 2017 21:01
Show Gist options
  • Save Chalarangelo/627c8a6e1e5f9ed6b02eb91ad46b460a to your computer and use it in GitHub Desktop.
Save Chalarangelo/627c8a6e1e5f9ed6b02eb91ad46b460a to your computer and use it in GitHub Desktop.
// Get page scroll percentage.
function getScrollPercent() {
return (
(document.documentElement.scrollTop || document.body.scrollTop)
/ ( (document.documentElement.scrollHeight || document.body.scrollHeight)
- document.documentElement.clientHeight)
* 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment