Skip to content

Instantly share code, notes, and snippets.

@Rahmanism
Last active January 7, 2023 09:16
Show Gist options
  • Save Rahmanism/000b9c7b79a2ed31b2bf7d717e1b614c to your computer and use it in GitHub Desktop.
Save Rahmanism/000b9c7b79a2ed31b2bf7d717e1b614c to your computer and use it in GitHub Desktop.
To check if user scrolled to the bottom of an HTML element
const elem = document.querySelector('#elem')
elem.onscroll = () => {
if (elem.clientHeight + elem.scrollTop >= elem.scrollHeight) {
console.log('You\'ve reached the bottom of text.')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment