Bootstrap snippet. bs4 alpha Dynamic Loading progress Bar

This snippet was created to help web designers, front-end and back-end developer save time. Use it in your project and build your app faster,
You can also download the HTML, CSS, and JS code.
tags: loading,progress,percentage,progressbar,loader

wave

HTML code

This is the html code used to create this bootstrap snippet, You can copy, paste, change, customize and run the following HTML code to get a result like the one shown in the preview selection



<div class="container">
  <div class="text-xs-center" id="example-caption-1">Reticulating splines&hellip; <span id="percentage" class="tag tag-default">0</span>%</div>

  <div class="parent">
    <progress class="progress progress-striped" value="0" max="100"></progress>
    <div class="child">
      <div class="btn-group" role="group" aria-label="First group">
        <button type="button" class="btn btn-outline-secondary" value="25" name="success">25%</button>
        <button type="button" class="btn btn-outline-secondary" value="50" name="info">50%</button>
        <button type="button" class="btn btn-outline-secondary" value="75" name="warning">75%</button>
        <button type="button" class="btn btn-outline-secondary" value="100" name="danger">100%</button>
      </div>
    </div>
  </div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.2/js/tether.min.js"></script>

CSS code

This is the css code used to create this bootstrap snippet, You can copy, paste, change, customize and run the following CSS code to get a result Like the one shown in the preview selection

body{
    background:#eee;    
}

.progress {
  height: 2.3em;
  margin-bottom: 0;
}
.btn-group {
  width: calc(100% + 3px);
}
.btn-group > .btn {
  width: 25%;
}
.btn-group > .btn:focus {
  outline: none;
  background-color: transparent;
}
.parent {
  position: relative;
  width: 100%;
  background:#fff;
}
.child {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 100%;
}

Javascript/Jquery code

This is the css code used to create this bootstrap snippet, You can copy, paste, change, customize and run the following JS code to get a result Like the one shown in the preview selection


$.fn.removeClassMatch = function(rexp) {
  return $(this).removeClass((i, className) => {
    return (className.match(rexp) || []).join(' ');
  })
}

let progressQueue = limit => {
  controlButton(true);
  
  for (let v = 0; v <= limit; v++) {
    $('progress').delay(50).queue(function() {
      $('#percentage').text(`${v}`);
      $(this).val(`${v}`).dequeue();
      // console.log($(this).queue().length);
      if ($(this).queue().length === 0) {
        controlButton(false);
      }
    })
  }
}

let controlButton = flg => {
  $button = $('button');
  $button.css({ 'color': 'white' });
  $button.prop('disabled', flg);
}

let addClassToProgress = name => {
  let $progress = $('progress');
  $progress.removeClassMatch(/progress-.+/g)
    .addClass(`progress-striped progress-${name}`);
}

let addClassToButtons = name => {
  let $button = $('button');
  $button.removeClassMatch(/btn-outline-.+/g)
    .addClass(`btn-outline-${name}`);
}

let addClassToTag = name => {
  let $tag = $('.tag');
  $tag.removeClassMatch(/tag-.+/g)
    .addClass(`tag-${name}`);
}

$('button').on('click', function() {
  let [type, limit] = [$(this).attr('name'), parseInt($(this).val())];
  
  addClassToProgress(type);
  addClassToButtons(type);
  addClassToTag(type);
  progressQueue(limit);
}) 

Similar snippets

Bootstrap load page indicator example

load page indicator

Bootstrap team members with skill progress example

team members with skill progress

Bootstrap infinite page loader example

infinite page loader

Bootstrap bs4 project list with progress example

bs4 project list with progress

Bootstrap bs4 pricing page example

bs4 pricing page

Bootstrap product catalog example

product catalog

Bootstrap shopping cart table example

shopping cart table

Bootstrap Blog Comments With Form example

Blog Comments With Form

Comments

Bootstrap snippets. bs4 alpha Dynamic Loading progress Bar

About this bootstrap snippet

This bootstrap snippet, bs4 alpha Dynamic Loading progress Bar, was published on Mar 1st 2018, 13:15 by Dey Dey and it is free.

We hope you will enjoy this awesome snippet and stay tuned for the latest updates, bootdey snippets are already used in thousands of blogs, websites and projects. We believe it will save your precious time and gives trendy look to your next web project.

We always try to offer the best beautiful and responsive source of Bootstrap code examples and components.

This snippet currectly have 2.8K views, Using this bootstrap snippet you have the following benefits:

Bootstrap 4.0.0-alpha.5

This snippet is based on bootstrap 4.0.0-alpha.5 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

Jquery plugins

Great built-in plugins with jquery framework, you can easy to change all declarations

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This snippet can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working