Files
30-seconds-of-code/snippets/bottom-visible.md
2017-12-13 14:14:04 +02:00

326 B

Bottom visible

Use scrollY, scrollHeight and clientHeight to determine if the bottom of the page is visible.

const bottomVisible = _ => 
  document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight || document.documentElement.clientHeight;
// bottomVisible() -> true