+ 2
How do you stop a progress bar?
with a button to be more specific [still waiting for the answer]
1 Respuesta
+ 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 😊