Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> </head> <body> <h1>Scroll page</h1> <script> function scrollBottom() { while(true) { let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom; // if the user scrolled far enough (<500px to the end) if(windowRelativeBottom > document.documentElement.clientHeight + 500) break; document.body.insertAdjacentHTML("beforeend", `<p>Date: ${new Date()}</p>`); } } window.addEventListener('scroll', scrollBottom); scrollBottom(); // init document </script> </body> </html>