let totalHight; let moved; let Prostick; window.addEventListener('scroll', function () { if (totalHight && Prostick) { let pro = (moved / totalHight) * 100; Prostick.style.width = pro + '%'; } });