In many cases I wish animation to be executed synchronously. Especially when I wish to make a a series of sequential animations.
Is there an easy way to make a jQuery animate function call synchronous?
The only way I thought about is to set a flag true when the animation has finished and to wait for this flag.
jQuery cannot make synchronous animations.
Remember that JavaScript runs on the browser’s UI thread.
If you make a synchronous animation, the browser will freeze until the animation finishes.
Why do you need to do this?
You should probably use jQuery’s callback parameter and continue your method code in the callback, like this:
This is called a closure.