Files
30-seconds-of-code/snippets/bottomVisible.md
Isabelle Viktoria Maciohsek 2b6f2b1740 Update snippet descriptions & tags
2020-10-18 23:04:45 +03:00

19 lines
420 B
Markdown

---
title: bottomVisible
tags: browser,beginner
---
Checks if the bottom of the page is 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);
```
```js
bottomVisible(); // true
```