How to make a non-blocking sleep in javascript/jquery?
At the risk of stealing the answer from your commentors, use setTimeout(). For example:
var aWhile = 5000; // 5 seconds
var doSomethingAfterAWhile = function() {
// do something
}
setTimeout( doSomethingAfterAWhile, aWhile );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With