Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap progress bar not animating

I've installed bootstrap to my Rails 4 application using the ruby gem.

I have copied and pasted the code for an animated progress bar straight from bootstraps docs into my page:

<div class="progress progress-striped active">
   <div class="progress-bar"  role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
      <span class="sr-only">45% Complete</span>
   </div>
</div>

But the bar is not animating. The only thing I can think of is the fact that I changed the bar's color in the sass variables.

Why isn't it animating?

Edit

What my bar looks like: broken progress bar

Edit

Here is the CSS being applied when I use the active class: enter image description here

like image 606
Deekor Avatar asked May 15 '14 21:05

Deekor


People also ask

How do I make my bootstrap progress bar dynamic?

For creating a default static progress bar, we need the following elements. aria-valuenow- This is known as curent progress bar value. aria-valuemin- This is known as initial value of the progress bar value. aria-valuemax- This is known as maximum value of the progress bar value.

Which class in bootstrap is used to create an animated progress bar?

You have to use class . active to create animated progress bar.


2 Answers

It's just that the translucent white stripes (rgba(255,255,255,.15)) don't show up on certain colours.

Take the Chrome browser's yellow. If we take that colour in Photoshop, then place a white stripe over it with .15 opacity, it's not visible. I've put the outline on it here so you can see where the stripe is.

enter image description here

So for certain colours, you may need to adjust the alpha of the stripe colour. I've added a class of .progress-bar-primary to the .progress-bar, in a similar way to how you'd add .progress-bar-warning etc.

<div class="progress progress-striped active">
  <div class="progress-bar progress-bar-primary"  role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
    <span class="sr-only">45% Complete</span>
  </div>
</div>

Then for that .progress-bar-primary, just change the alpha of the stripe to your taste. For the Chrome Yellow, I've used .75 opacity.

.progress-bar-primary {
  background-color: yellow;
}

.progress-striped .progress-bar-primary {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .75)   25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .75) 50%, rgba(255, 255, 255, .75) 75%, transparent 75%, transparent);
}

Demo Here

like image 87
davidpauljunior Avatar answered Oct 18 '22 22:10

davidpauljunior


Replace class="bar" with class="progress-bar".

like image 25
Dilantha Maneth Perera Avatar answered Oct 18 '22 22:10

Dilantha Maneth Perera