Created
March 14, 2022 10:42
-
-
Save Kadreev/99df7e1d60ac4e266df0bfd6f6422355 to your computer and use it in GitHub Desktop.
progress percentage increase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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