Skip to content

Instantly share code, notes, and snippets.

@erm3nda
Created October 12, 2020 14:47
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 erm3nda/3adcec8feea29433c8a7d36803fed31b to your computer and use it in GitHub Desktop.
Save erm3nda/3adcec8feea29433c8a7d36803fed31b to your computer and use it in GitHub Desktop.
Javascript code to detect when we are at bottom of the scroll
window.onscroll = function() {
// @var int totalPageHeight
var totalPageHeight = document.body.scrollHeight;
// @var int scrollPoint
var scrollPoint = window.scrollY + window.innerHeight;
// check if we hit the bottom of the page
if(scrollPoint >= totalPageHeight)
{
console.log("at the bottom");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment