JSFiddle - React, Tailwind, and code Playground
by Gregory Nikitas
HTML
<div class="col s4 m4 l5" style="position: relative; margin-top: 10%;">
<div class="left-align">PRINTING</div>
<div class="progress progress-dashboard-full statusBars" style="position:relative;">
<div id="talkbubble" style="z-index: 1; position: absolute; top: 0px; left: 0px; text-align: center;">0/20</div>
<div class="determinate progress-dashboard-loaded" style="width: 0px;"></div>
</div>
</div>
CSS
.progress{
height: 26px;
position: absolute;
left: 50%;
top: 50%;
width: 200px;
background: rgba(159, 159, 159, 0.5);
border-radius: 10px;
margin: -20px 0 0 -100px;
padding: 2px;
}
.determinate{
transition: all 100ms ease;
height: 20px;
width: calc(100% - 10px);
border-radius: 8px;
background: #474747;
position: absolute;
margin: 3px;
display: inline-block;
}
#talkbubble{
font-family: Arial;
font-weight: bold;
text-align: center;
margin-top: -30px;
}
JavaScript
var intervalId = setInterval(simulatePrint, 500);
var pages = 0;
var barWidth = 200;
var maxPages = 20;
function simulatePrint() {
pages++;
if (pages > maxPages)
{
pages = 0;
}
$("#talkbubble").css("width", getTabMargin());
$(".progress-dashboard-loaded").css("width", getprogressWidth());
$("#talkbubble").text(pages+"/"+maxPages);
}
function getprogressWidth() {
return ((pages / maxPages) * barWidth);
}
function getTabMargin() {
return ((pages / maxPages) * barWidth);
}