Skip to content

Instantly share code, notes, and snippets.

@Kadreev
Created March 14, 2022 10:42
Show Gist options
  • Select an option

  • Save Kadreev/99df7e1d60ac4e266df0bfd6f6422355 to your computer and use it in GitHub Desktop.

Select an option

Save Kadreev/99df7e1d60ac4e266df0bfd6f6422355 to your computer and use it in GitHub Desktop.
progress percentage increase
const updateCount = (setProgress, progressPercent) => {
const target = parseInt(setProgress.getAttribute("data-done"));
const count = parseInt(progressPercent.innerText);
const increment = 1;
if (count < target) {
progressPercent.innerText = count + increment;
setTimeout(updateCount, 50);
} else if (count > target) {
progressPercent.innerText = count - increment;
setTimeout(updateCount, 50);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment