I have a form inside a bootstrap modal. I awake it using jQuery $(modalId).modal('show');
I don't want it to be fade in. So, I didn't add 'fade' class to my modal. upon submitting the form in modal. I want to fade out the modal.
$(modalId).modal('hide');
I used the above code segment to hide the modal, it works. But, the modal goes out very quickly. I want it to fade out for a few seconds. How can I achieve it?
My code:
$('.save').on('click', function(){
setTimeout(function(){
$('#div_dbReadMany').modal("hide");
}, 1500);
});
Fiddle
I found the solution by adding a delay to fadeout the modal and increased the time out on
$(modalId).modal('hide');
Code is here:
$('.save').on('click', function(){
$('#div_dbReadMany').delay(1000).fadeOut(450);
setTimeout(function(){
$('#div_dbReadMany').modal("hide");
}, 1500);
});
Use this code.
$('.save').on('click', function(){
$('#div_dbReadMany').delay(1000).fadeOut('slow');
setTimeout(function() {
$("#div_dbReadMany").modal('hide');
}, 1500);
});
DEMO
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