JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css">
<div class="progress">
<div class="bar" id="progress"></div>
</div>
CSS
body {padding: 50px;}
JavaScript
function countdown(callback) {
var bar = document.getElementById('progress'),
time = 0, max = 5,
int = setInterval(function() {
bar.style.width = Math.floor(100 * time++ / max) + '%';
if (time - 1 == max) {
clearInterval(int);
// 600ms - width animation time
callback && setTimeout(callback, 600);
}
}, 1000);
}
countdown(function() {
alert('Redirect');
});