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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -