fgnass / spin.js

A spinning activity indicator
http://spin.js.org
MIT License
9.3k stars 1.02k forks source link

Ability to pause the spinner without removing it #303

Closed heaven closed 1 month ago

heaven commented 8 years ago

I have slides on the page, they switch with animation. Adding spin.js slows those down. Actually not just slows, they stop working at all. I need an ability to pause spinners before call "animate" on the slides switch and run it again after animation is done.

theodorejb commented 4 years ago

Using spin.js v4 you can accomplish this yourself with a few lines of code. Add the following rule to your CSS file:

.paused > div > div {
    animation-play-state: paused !important;
}

Then the paused state can be togged like this in your JavaScript/TypeScript code (where spinner is an instance of the Spinner class):

spinner.el.classList.toggle('paused');