Last active
January 7, 2023 09:16
-
-
Save Rahmanism/000b9c7b79a2ed31b2bf7d717e1b614c to your computer and use it in GitHub Desktop.
To check if user scrolled to the bottom of an HTML element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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