javascript - jQuery animation() - complete firing too soon -


i wrote little animation script fades set of stripes left right. after animations complete callback functions shoud run.

the script here:

http://jsfiddle.net/9zkbu/

it works fine, want same right-to-left animation:

http://jsfiddle.net/ftrhx/

as can see callback function fired before animation ends :( thing changed delay(). doing wrong here? why "complete" running before animations finish?

you there, did reverse direction, forgot on callback account reversal. doing works me:

complete: (i == 0) ? function(){alert('done');} : null 

because counting other direction if try , check complete @ cols - 1 you'll early, need @ 0 here. try one: http://jsfiddle.net/ftrhx/8/


Comments