I’m using bootstrap 4. When an event begins, I can get the spinner to spin using the following:
<span class='spinner-border spinner-border-sm text-primary' role='status' aria-hidden='true' id='spinner' style='display: none'></span>
document.getElementById('spinner).style.display = 'inline-block';
But how do I stop it spinning? I don’t want to hide the spinner because I want to display the static image. Is there any way to do that?
2
Answers
Solution
The solution is quite simple. All you have to do is set
animation
tonone
:Demo
Below is a code snippet to demo it. The spinner will stop after
2s
of running.To stop the animation you can set the iteration count to 0
To continue the animation simply set it back to its original value