Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Animation complete callback called many times #7146
When using a
The callback is called a bazillion times.
Live demo with steps to reproduce
Google Chrome 60
Yes that's what happens... The animation config gets passed on to all the elements that are animated.
It also happens with other functions: http://jsfiddle.net/highcharts/0186u06j/1/
I'm not quite sure how to handle that, it would require some restructuring and rethinking of animation, and it will definately be prone to regressions.
A simple workaround would be to set a flag from the callback to ensure it only runs once.
This came back to bite my ass
I was doing as you said and only invoking the callback when the first element finishes it's animation.
That worked fine until this change: b4b4221#diff-4902869e857fed10664dc3f6cb635c92R182
That is, now the callback is invoked immediately for those elements that didn't change, and then again after a while, when the actual animation finishes.
How have you been handling that?