+ 2

How do you stop a progress bar?

with a button to be more specific [still waiting for the answer]

18th Jul 2017, 4:31 PM
_Retr0/-
_Retr0/- - avatar
1 Answer
+ 8
You could use setInterval() method to create a dynamic progress bar and then make it stop with clearInterval() method, this way you could stop calling the function that's making the progress advance. You would have to create a variable to act as a counter and also pass it to the progress bar's value, it could start at zero, increment by 1 everytime you call the function, and when it hits 100 or you press the 'stop' button you can make it stop. Here's an example: https://code.sololearn.com/WfN5VrRrIMOd/?ref=app Not sure about your JS level, so let me know if you'd like me to add more comments to the code 😊
19th Jul 2017, 1:42 AM
Pao
Pao - avatar