File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
2-ui/3-event-details/8-onscroll/1-endless-page Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,13 @@ function populate() {
5555 // нижняя граница документа
5656 let windowRelativeBottom = document .documentElement .getBoundingClientRect ().bottom ;
5757
58- // если пользователь прокрутил достаточно далеко (< 100px до конца)
59- if (windowRelativeBottom < document .documentElement .clientHeight + 100 ) {
60- // добавим больше данных
61- document .body .insertAdjacentHTML (" beforeend" , ` <p>Дата: ${ new Date ()} </p>` );
58+ // если пользователь не прокрутил достаточно далеко (>100px до конца страницы) — прерываем цикл
59+ if (windowRelativeBottom > document .documentElement .clientHeight + 100 ) {
60+ break ;
6261 }
62+
63+ // добавим больше данных
64+ document .body .insertAdjacentHTML (" beforeend" , ` <p>Date: ${ new Date ()} </p>` );
6365 }
6466}
6567```
You can’t perform that action at this time.
0 commit comments