Trying to solve a persistent issue.
In my Symfony application with Bootstrap, I created a ProgressBar. The code snippet below displays the bar:
<link href="https://bootswatch.com/5/sketchy/bootstrap.min.css" rel="stylesheet"/>
<div class="progress">
<div style="width:100%" class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar"></div>
<div style="width:100%" class="progress-bar progress-bar-striped progress-bar-animated bg-success" role="progressbar"></div>
<div style="width:100%" class="progress-bar progress-bar-striped progress-bar-animated bg-info" role="progressbar"></div>
</div>
My aim is to overlap the bars for three different values. For instance:
- Bar1 should show 50% progress
- Bar2 should display 75% progress (50% from Bar1 + 25% individual)
- Bar3 should indicate 100% progress (50% from Bar1 + 25% from Bar2 + 25% individual)
To achieve this configuration, use these widths:
- Bar1: 200% width
- Bar2: 100% width
- Bar3: 100% width
<link href="https://bootswatch.com/5/sketchy/bootstrap.min.css" rel="stylesheet"/>
<div class="progress">
<div style="width:200%" class="progress-bar progress-bar-striped progress-bar-animated bg-danger" role="progressbar"></div>
<div style="width:100%" class="progress-bar progress-bar-striped progress-bar-animated bg-success" role="progressbar"></div>
<div style="width:100%" class="progress-bar progress-bar-striped progress-bar-animated bg-info" role="progressbar"></div>
</div>
However, what if I want to represent the following:
- Bar1: 30% progress
- Bar2: 70% progress
- Bar3: 100% progress
I'm in need of a function to calculate the widths for the three bars based on my desired values. Then I can update the width value using JavaScript.