Reading Progress Bar
A top progress bar that fills as the article is scrolled.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div style="max-width:340px"><div class="progress sticky-top" style="height:4px;border-radius:0"><div class="progress-bar" id="spBar" style="width:0"></div></div>
<div class="border border-top-0 rounded-bottom overflow-auto p-3 small text-secondary" id="spScroll" style="height:220px"><h6>Article</h6><p>This bar fills as you read through the content below.</p><div style="height:150px"></div><p>Keep scrolling…</p><div style="height:150px"></div><p>You've reached the end.</p></div>
</div>var sc=document.getElementById('spScroll'),bar=document.getElementById('spBar');
sc.addEventListener('scroll',function(){var max=sc.scrollHeight-sc.clientHeight;bar.style.width=(max>0?sc.scrollTop/max*100:0)+'%'});Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.