I am showing a Bootstrap modal window for loading when performing AJAX calls. I broadcast a \"progress.init\" event when the loading modal should show and a \"progress.finis
So if you don't want to remove fade or tinker with the dom objects, all you have to do is make sure you wait for the show to finish:
$('#load-modal').on('shown.bs.modal', function () {
console.log('Shown Modal Backdrop');
$('#load-modal').addClass('shown');
});
function HideLoader() {
var loadmodalhidetimer = setInterval(function () {
if ($('#load-modal').is('.shown')) {
$('#load-modal').removeClass('shown').modal('hide');
clearInterval(loadmodalhidetimer);
console.log('HideLoader');
}
else { //this is just for show.
console.log('Waiting to Hide');
}
}, 200);
}
IMO Bootstrap should already be doing this. Well perhaps a little more, if there is a chance that you could be calling hide without having done show you may want to add a little on show.bs.modal add the class 'showing' and make sure that the timer checks that showing is intended before getting into the loop. Make sure you clear 'showing' at the point it's shown.