Files
30-seconds-of-code/snippets/bottom-visible.md
2017-12-17 11:54:53 +01:00

10 lines
326 B
Markdown

### Bottom visible
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;
// bottomVisible() -> true
```