Detect if user scrolled to bottom of the page

PHOTO EMBED

Tue Jun 29 2021 09:05:03 GMT+0000 (UTC)

Saved by @desiboli #javascript #react.js #vue.js #angular #typescript

const { scrollTop, offsetHeight } = document.documentElement;
const { innerHeight } = window;
const bottomOfWindow = Math.round(scrollTop) + innerHeight === offsetHeight;

if (bottomOfWindow) {
  console.log('Bottom of window');
}
content_copyCOPY