@buuug7/simplify-progress

0.1.2 • Public • Published

simplify progress

Install

install @buuug7/simplify-progress package via npm, and then import from @buuug7/simplify-progress/index.css file.

npm install @buuug7/simplify-progress

Demo examples

Usage

<div class="progress">
  <div class="bar" style="width: 50%"></div>
</div>

the progress bar width style specified the progress current percentage, you can change it dynamic by using javascript like below.

function progress(selector) {
  let el = document.querySelector(selector);
  let percentage = 50;
  let id = setInterval(frame, 100);

  function frame() {
    if (percentage >= 100) {
      clearInterval(id);
    } else {
      percentage++;
      el.style.width = percentage + '%';
    }
  }
}

Dependents (0)

Package Sidebar

Install

npm i @buuug7/simplify-progress

Weekly Downloads

6

Version

0.1.2

License

ISC

Unpacked Size

3.33 kB

Total Files

5

Last publish

Collaborators

  • buuug7