Infinity Scroll

PHOTO EMBED

Wed Jul 21 2021 21:42:29 GMT+0000 (Coordinated Universal Time)

Saved by @jolo #javascript

window.onscroll = async () => {
  const scrollHeight = document.documentElement.scrollHeight
  const scrollTop = document.documentElement.scrollTop
  const clientHeight = document.documentElement.clientHeight
  if (scrollTop + clientHeight > scrollHeight - 5) {
    
    // .. API async Fetch

  }
}
content_copyCOPY

Vanilla Javascript for an Infinity Scroll

https://javascript.plainenglish.io/building-an-infinite-scroll-with-vanilla-javascript-32810bae9a8c