I'm using jQuery delay()
function to delay a show()
event, but after that I want to change the location.href of the page. How can I do that?
$('#error').delay(800).show();
location.href = '/profile'
Sorry, I forgot to mention I want to delay the redirect as well.
Provide a callback for show()
$('#error').delay(800).show(0, function () {
setTimeout(function () {
location.href = '/profile'
}, 8000);
});
documentation on .show() http://api.jquery.com/show/
The 'show' will happen after 800 milliseconds, then after the element is shown, the redirect will occur 8 seconds later. With this code you will have 2 'delays' so to speak.
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