Animated Progress Bar
A progress bar that animates from 0 to 100% on button click.
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 class="card border-0 shadow-sm" style="max-width:340px"><div class="card-body text-center">
<div class="progress mb-3" style="height:10px"><div class="progress-bar" id="paBar" style="width:0;transition:width .3s"></div></div>
<button class="btn btn-primary btn-sm" id="paBtn">Start</button>
</div></div>var bar=document.getElementById('paBar'),btn=document.getElementById('paBtn'),busy=false;
btn.onclick=function(){if(busy)return;busy=true;var p=0,t=setInterval(function(){p+=5;bar.style.width=p+'%';bar.textContent=p+'%';if(p>=100){clearInterval(t);busy=false}},100)};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.