How to check if the bottom of a page is in the viewport?

const getBottomVisiblity = () =>
  document.documentElement.clientHeight + window.scrollY >=
  (document.documentElement.scrollHeight || document.documentElement.clientHeight)

// output: true

October 1st, 2019

# Get page bottom visibility

Add to bookmarks

Returns true if the document height plus the currently scrolled pixel number is larger/equal to the document's content height or rather document height.

Apply that function to a scroll event listener and you can always check if the page bottom is visible.