Reputation: 784
Is it posible to setTimeout
on beforeSend
so ajax spinner will spin 4 seconds ? Or I have to use differed function to do that?
The reason I wanna do that is because some times for is processing so fast that user cant even see the effect with ajax spinner.
var v = $("#contact-form").validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
beforeSend: function() {
$('.submit-btn button').addClass('loading');
},
url: 'send-mail.php',
success: function() {
$('.submit-btn button').addClass('message-sent');
},
complete: function() {
$('.submit-btn button').removeClass('loading').text('Send'); }
});
v.resetForm();
}
})
Upvotes: 0
Views: 638
Reputation: 28511
It is possible using an animation queue. However this is not recommended. I mean you want to make a fast user interface, so why would I as a user be forced to wait 4 seconds if the server interaction has finished much faster?
The graphics side of it may look tempting, but from a UX point of view, just leave it as it is.
Upvotes: 2