Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:30:55+00:00 2026-06-10T14:30:55+00:00

Bootstrap has many pre-defined styles for progress bar, but how to make them some

  • 0

Bootstrap has many pre-defined styles for progress bar, but how to make them some dynamic changing feature. With my poor knowledge of javascript (first stages on codeacademy), can’t make them change dynamically by width style changing, and that’s the question.

<div class="progress bar-success">
<div class="bar" style="width: 'value'%"></div>
</div>

need to define by javascript if ‘value’, if “bar” style width >50% when remove parent class “bar-success” and add class “bar-warning”, when style width >80% change it to “bar-danger”.

found smth like this with jquery http://jsfiddle.net/ZQrnC/ but think it would be better to have such a script for pure js to use it in bootstrap.

in this question also reccomended to use addClass but this seems too difficult for me

here some bootstrap progress bar markup http://jsfiddle.net/pZ5mG/

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:30:57+00:00Added an answer on June 10, 2026 at 2:30 pm

    Here’s a strictly vanilla.js solution: http://jsfiddle.net/pZ5mG/2/

    HTML

    <div class="progress">
        <div id="myProgress" class="bar bar-danger"></div>
    </div>​
    

    JS

    var bar = document.getElementById("myProgress");
    var progress = 0;
    
    
    function setProgress(percent){
        bar.style.width = percent + "%";
    
        if (percent > 90)
            bar.className = "bar bar-success";
        else if (percent > 50)
            bar.className = "bar bar-warning";
    }
    
    var interval = setInterval(
        function(){
            setProgress(++progress);
            if (progress == 100) window.clearInterval(interval);
        }, 100);
    

    Is this about what you are wanting to accomplish? (Obviously you wouldn’t be using an Interval to update the progress)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Bootstrap on a web app that has some pages that contain iframes.
I am using twitter bootstrap and have a fixed nav bar. The navbar has
I'm toying around with jade.js and Bootstrap, from twitter. Bootstrap has some classes with
Twitter-Bootstrap buttons are awesomely beautiful. Try them out by scrolling over them But they
I used bootstrap-tabs.js and it has worked perfectly. But I didn't find information about
I can hack this myself, but I think bootstrap has this capability.
Twitter Bootstrap has a form control that would glow on the borders when in
I am using the Bootstrap CSS framework that has this: .dropdown-menu { left: 0;
I'm using the Twitter Bootstrap fixed layout where the container div has: margin-left: auto;
In Bootstrap, How to make a link (button) which toggles a region. My intention

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.