Skip to content

Instantly share code, notes, and snippets.

Created October 12, 2020 14:47
What would you like to do?
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