jquery - JavaScript execution order - run this(), then that() when this() has finished? -
For example, I have to do something simple like jQuery:
$ ("<"> div ") fadein ('sharp'). $ ( "Div") HTML ('Foo');
He fades into the div, and while still setting his html in "foo" it still fades, FadeIn ('fast', function () {$ ("div"). Html ('foo');}); < / F>
"Foo" will be set to html only after it vanishes in the divas.
Does this type of thing work normally javascript? Some other var var = fooBar ();
Will it start doing something else, while it is still doing something, or will it patiently wait for something to finish before doing something?
Javascript in general does not works like this, you are seeing the result of jQuery animations and callback. If you run the current thread Everybody is kicking afterwards (animation is).
Another function that you have (or a function) near callback , is done when it is done. Although outside of the interval and timer, your script will take place in order.
Even in order with the interval and the timer, it is not just the order in the code, in chronological order when things should do what they do (They finish in time and the main thread is not waiting, even then they are in order , if not then on time ).
Comments
Post a Comment