javascript - Ladda spin animation keeps spinning for one second after stop() -
i'm using ladda spinner this:
var l = ladda.create(document.getelementbyid('ladda-test')); l.start(); l.stop(); console.log('ladda stoped');
my problem after l.stop()
executed, animation not instantly stop: spin animation stops after 1 second.
you can use timeout function wait 1 second - execute code.
the settimeout() method wait specified number of milliseconds, , execute specified function.
the first parameter of settimeout() should function.
the second parameter indicates how many milliseconds, now, want execute first parameter.
for example:
var l = ladda.create(document.getelementbyid('ladda-test')); l.start(); settimeout(function() { l.stop(); console.log('ladda stoped'); }, 2000); // unit equates 2 seconds
you can learn more timing events here: http://www.w3schools.com/js/js_timing.asp
Comments
Post a Comment