Merge pull request #2054 from peachesontour/patch-7

The solution here had no break, an infinite loop. Modified to match plunker example code
This commit is contained in:
Ilya Kantor 2020-08-27 23:35:50 +03:00 committed by GitHub
commit 1bd9b9e9b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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", `<p>Date: ${new Date()}</p>`);
}
// 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", `<p>Date: ${new Date()}</p>`);
}
}
```