Files
30-seconds-of-code/snippets/bottomVisible.md
2020-09-15 21:52:00 +03:00

451 B

title, tags
title tags
bottomVisible browser,intermediate

Returns true if the bottom of the page is visible, false otherwise.

  • 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