O
O
olya_0972020-04-15 21:08:08
JavaScript
olya_097, 2020-04-15 21:08:08

How to animate not only the stripes, but also the percentage values?

80 /1 / 18
from 0 to the desired number
https://codepen.io/Olya097/pen/BaojdEq

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2020-04-15
@olya_097

$('.progress__item').each(function() {
  const $this = $(this);
  const $progressBar = $this.find('.progress__bar');
  const $value = $this.find('.progress__value');
  const value = $progressBar.data('progress-value');

  $progressBar.width(`${value}%`);

  $({ value: 0 }).animate({
    value,
  }, {
    duration: 1000,
    step: val => $value.text(`${val.toFixed(1)} %`),
  });
});

R
rasschitai, 2020-04-15
@rasschitai

do it completely in JS, through a timer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question