let totalHeight = 0;.md

Anonymous
markdown
02/19/2026 5:34 AM
488 B
13
Indexable

let totalHeight = 0;
let distance = 1000;
let timer = setInterval(() => {
let scrollHeight = document.body.scrollHeight;
window.scrollBy(0, distance);
totalHeight += distance;

if (totalHeight >= scrollHeight - window.innerHeight) {  
    clearInterval(timer);  
    console.log("خلص التحميل");  
}  

}, 1000);

Leave a Comment