From 8a70b745f0bbb49b917bad105846611c680e14c6 Mon Sep 17 00:00:00 2001 From: Peter Kampjes <67612358+peachesontour@users.noreply.github.com> Date: Sun, 9 Aug 2020 20:39:19 -0300 Subject: [PATCH] The solution here had no break, an infinite loop. --- .../8-onscroll/1-endless-page/solution.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/2-ui/3-event-details/8-onscroll/1-endless-page/solution.md b/2-ui/3-event-details/8-onscroll/1-endless-page/solution.md index 10945ccd..54c10119 100644 --- a/2-ui/3-event-details/8-onscroll/1-endless-page/solution.md +++ b/2-ui/3-event-details/8-onscroll/1-endless-page/solution.md @@ -55,11 +55,11 @@ function populate() { // document bottom let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom; - // if the user scrolled far enough (<100px to the end) - if (windowRelativeBottom < document.documentElement.clientHeight + 100) { - // let's add more data - document.body.insertAdjacentHTML("beforeend", `
Date: ${new Date()}
`); - } + // if the user hasn't scrolled far enough (>100px to the end) + if (windowRelativeBottom > document.documentElement.clientHeight + 100) break; + + // let's add more data + document.body.insertAdjacentHTML("beforeend", `Date: ${new Date()}
`); } } ```