Skip to content
This repository

spin/stop versus simple display css toggle #125

Closed
stevenbrezina opened this Issue · 2 comments

2 participants

stevenbrezina Felix Gnass
stevenbrezina

When trying to use the existing spin/stop functions to toggle the spinner on and off i noticed that a spin() call takes several seconds on a mobile device to display again after a stop() call. Looking at the code i noticed you are actually reinitializing the entire object again from scratch on a second call to spin(). Instead of a full re-init it was a much faster toggle for me to write a simple toggle function to modify the parent element css "display" to none or block. I wasnt able to get the parent div to behave by feeding it css directly so i just built a one line toggle function and added it to the code.

might be useful to add a toggle function to allow spin users to keep the object in memory to quickly toggle display. cheers on the great little widget in any case - very useful!

Felix Gnass
Owner

That's strange, the re-initialization shouldn't take that long as all it does it to create a bunch of DOM elements. Please keep in mind that if you don't call stop() spin.js will continue to use the CPU on browsers that don't support CSS animations as it falls back to a setTimeout-based approach in that case.

Felix Gnass
Owner
fgnass commented

I'm closing this as I can't reproduce the described behavior. Please provide an example on JsFiddle/JsBin/... and re-open the issue.

Felix Gnass fgnass closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.