Files
30-seconds-of-code/snippets/bottomVisible.md
Angelos Chalaris 611729214a Snippet format update
To match the starter (for the migration)
2019-08-13 10:29:12 +03:00

18 lines
448 B
Markdown

---
title: bottomVisible
tags: 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.
```js
const bottomVisible = () =>
document.documentElement.clientHeight + window.scrollY >=
(document.documentElement.scrollHeight || document.documentElement.clientHeight);
```
```js
bottomVisible(); // true
```