[Home] > Snippets  > Browser  > DOM  >  Check if user scrolls to the bottom of the page

Check if user scrolls to the bottom of the page

JavaScript

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

TypeScript

const isAtBottom = (): boolean => document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight