asynchronous - JQuery synchronous animation -
In many cases I want to execute animation in a synchronous way, especially when I want to create a series of sequential animations. .
Is a jQuery animate
function an easy way to make calls synchronous?
The only way I thought the animation is over and waiting for this flag is to set a flag right.
JQuery synchronous animation can not
Remember that on the UI thread of the browser Javascript is running.
If you create a synchronous animation, the browser will freeze until the animation is over.
Why do you need to do this?
You should probably use the jQuery callback parameter and your method code should continue in the callback, such as:
function doSomething () {var thingy = whatever; // Things $ ('some') Animate ({width: 70}, function () {// After the animation ends jQuery will call this method. // You can continue your code here. // You can access the external functions thingy = Thingy.fiddle;}); }
This is called termination.
Comments
Post a Comment