I\'ve the following JavaScript snippet:
$(\"#dashboard\").addClass(\"standby\").delay(3000).removeClass(\"standby\");
$(\".active\").removeClass(\"active\");
.delay()
will only delay animations in jQuery.
To set an actual delay, you might want to use setTimeout()
.
let cancelId;
// ...
cancelId = window.setTimeout(function() {
// ... do stuff ...
}, 3000);
// If you want to cancel prematurely, use `window.clearTimeout`
if (cancelId) {
window.clearTimeout(cancelId);
}
This will execute the code in ... do stuff ...
in 3 seconds (3000 miliseconds)