30-seconds-of-code
Version:
A collection of useful JavaScript snippets.
16 lines (11 loc) • 411 B
Markdown
### bottomVisible
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.
```js
const bottomVisible = () =>
document.documentElement.clientHeight + window.scrollY >=
(document.documentElement.scrollHeight || document.documentElement.clientHeight);
```
```js
bottomVisible(); // true
```