I'm trying to fire up a function after the animation has finished but i can't make it work.
Here is my code:
var count = 3;
var timer = setInterval(function () {
handleTimer(count);
}, 1000);
function endCountdown() {
$('.begin-btn').html("GO!");
}
function handleTimer() {
if (count === 0) {
clearInterval(timer);
endCountdown();
} else {
$('.begin-btn').html(count);
count--;
}
}
$('.begin-mrsuper').delay(500).animate({
"left": "4px"
}, "slow").promise().done(function (handleTimer) {});
I tryed and:
$('.begin-mrsuper').delay(500).animate({"left":"4px"}, "slow").promise().done(function(){ handleTimer(); });
But the 3,2,1, GO timer starts before the animation finishes, any ideas?