<!DOCTYPE HTML>
<html>
<body>
<h1>Scroll me</h1>
<script>
function populate(){
while(true){
let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom;
//when the scroll is about to reach at the end
if(windowRelativeBottom > document.documentElement.clientHeight + 100) break;
document.body.insertAdjacentHTML("beforeend", `<p>Date : ${new Date()}</p>`);
}
}
window.addEventListener('scroll', populate);
populate();//first page contents
</script>
<body>
</html>
<html>
<body>
<h1>Scroll me</h1>
<script>
function populate(){
while(true){
let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom;
//when the scroll is about to reach at the end
if(windowRelativeBottom > document.documentElement.clientHeight + 100) break;
document.body.insertAdjacentHTML("beforeend", `<p>Date : ${new Date()}</p>`);
}
}
window.addEventListener('scroll', populate);
populate();//first page contents
</script>
<body>
</html>
댓글
댓글 쓰기