The solution here had no break, an infinite loop.

This commit is contained in:
Peter Kampjes 2020-08-09 20:39:19 -03:00 committed by GitHub
parent fbf443e414
commit 8a70b745f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,11 +55,11 @@ function populate() {
// document bottom // document bottom
let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom; let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom;
// if the user scrolled far enough (<100px to the end) // if the user hasn't scrolled far enough (>100px to the end)
if (windowRelativeBottom < document.documentElement.clientHeight + 100) { if (windowRelativeBottom > document.documentElement.clientHeight + 100) break;
// let's add more data // let's add more data
document.body.insertAdjacentHTML("beforeend", `<p>Date: ${new Date()}</p>`); document.body.insertAdjacentHTML("beforeend", `<p>Date: ${new Date()}</p>`);
} }
} }
}
``` ```