From fceabcc75f55d1d7bdfaa3ce6c50a4e29d621d13 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 13 Dec 2017 14:15:07 +0200 Subject: [PATCH] Build README --- README.md | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5c7bbdd49..d828616ad 100644 --- a/README.md +++ b/README.md @@ -95,19 +95,12 @@ const average = arr => ### Bottom visible -Returns `true` if bottom of the page is visible. It adds `scrollY` to -the height of the visible portion of the page (`clientHeight`) and -compares it to `pageHeight` to see if bottom of the page is visible. +Use `scrollY`, `scrollHeight` and `clientHeight` to determine if the bottom of the page is visible. ```js -const bottomVisible = () => { - const scrollY = window.scrollY; - const visibleHeight = document.documentElement.clientHeight; - const pageHeight = document.documentElement.scrollHeight; - const bottomOfPage = visibleHeight + scrollY >= pageHeight; - - return bottomOfPage || pageHeight < visibleHeight; -} +const bottomVisible = _ => + document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight || document.documentElement.clientHeight; +// bottomVisible() -> true ``` ### Capitalize first letter of every word