JSFiddle - React, Tailwind, and code Playground
HTML
<div class="bar">
<div class="bar__progress"></div>
<div class="bar__title">11-минутная шавасана</div>
</div>
<p id="out"></p>
SCSS
.bar {
position: relative;
border-radius: 15px;
height: 30px;
width: 300px;
background-color:#B0B0B0;
overflow: hidden;
&__progress {
background: #444;
height: 100%;
width: 30%;
z-index: 1;
cursor: e-resize;
}
&__title {
cursor: text;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
color: #fff;
font-size: 14px;
padding: 1px 15px;
z-index: 2;
pointer-events: none;
}
}
JavaScript
$('.bar__progress').on('click', function() {
var barWidth = $('.bar').width(),
progressWidth = $(this).width();
if (progressWidth < barWidth) {
$(this).width($(this).width() + 10);
$('#out').html(progressWidth);
} else {
$('#out').html('песня закончилась :)');
}
});