Header
$(document).ready(function() {
$('#user_box').animate({width: "263px"}, "slow");
$('#submit').click(function(){
$('#user_box').animate({width: "0px"}, "slow");
});
});
Content
<div id="user_box">
<form name="login_form" id="login_form" method="post" action="index.php">
Username:<br />
<input type="text" name="username"><br />
<input type="submit" value="Submit" id="submit" />
</form>
</div>
As you can see, I've made it do when submit is clicked, the user_box animates back to 0pxs (slides right). Problem is I need to delay the page load by about 1 second to give the animation time to finish. But only when the Submit button is clicked. How can I delay the page to allow the animation to finish?
I've tried..
$('#submit').delay(3500, function(){
window.location = toLoad;
});
with no joy. Any help would be greatly appreciated. Thank you.
p.s. The general idea is the user_box slides right with each query and return left with result. It'll be mainly PHP, hence the on page load it slide right to left. I'll wangle something later to stop it happening when logged in or something.