spin/stop versus simple display css toggle #125

Closed
ghost opened this Issue Feb 22, 2013 · 2 comments

Projects

None yet

1 participant

@ghost
ghost commented Feb 22, 2013

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!

@fgnass
Owner
fgnass commented Apr 2, 2013

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.

@fgnass
Owner
fgnass commented May 14, 2013

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

@fgnass fgnass closed this May 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment