Page Height Bottom 1

Page Height Bottom

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

Here is what the above code is Doing:
1. We’re creating a function called scrolledToBottom that returns a boolean value.
2. The boolean value is determined by comparing the height of the viewport (document.documentElement.clientHeight) to the height of the entire document (document.documentElement.scrollHeight).
3. If the viewport height is greater than or equal to the document height, then we know we’ve scrolled to the bottom of the page.

Similar Posts