Sunday, 8 September 2013

Kind of custom animation - delay doesn't work

Kind of custom animation - delay doesn't work

It is custom animation attempt, which works with background-position.
var i=5;
while(i!==0){
setTimeout(function() {
$("#feedback-toad").css("height","+=50");
$("#feedback-toad").css("background-position", "50% "+i*(-20)+"%");
}, 1000);
i=i-1;}
It works in terms of final result - finally element looks like I want.
But it doesn't look like animation, it happens instantly - looks like
delay (timeout) doesn't work.
Why? How I can fix that?
P.S. I don't need plugin suggestion - I would like to do it with my own
code. Thanks.

No comments:

Post a Comment