![]() Many workarounds are there to try to implement such functions. delay () method is best for delaying between queued jQuery effects. I understand that using setTimeout() involves more thought than a desirable sleep() function, but unfortunately the later doesn't exist. 1 ( 'foo' ).slideUp ( 300 ).delay ( 800 ).fadeIn ( 400 ) When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds. Var y = null // To keep under proper scope You use setTimeout() to rewrite it this way: var x = 1 Place mysterious code that blocks the thread for 100 ms. ![]() It's not that hard to use actually, instead of writing this: var x = 1 Unfortunately, setTimeout() is the only reliable way (not the only way, but the only reliable way) to pause the execution of the script without blocking the UI.
0 Comments
Leave a Reply. |