Hide Bootstrap modal with fade out effect using Javascript
问题 I have a basic bootstrap modal to log in, which doesn't close itself when I hit submit. I solved it using this simple jquery: $('#myModal').modal('hide'); But I also want the modal to fade out properly using bootstrap's fade class - which currently doesn't happen, it instantly gets hidden. How can I do this? 回答1: $('#myModal').delay(1000).fadeOut(450); setTimeout(function(){ $('#myModal').modal("hide"); }, 1500); 回答2: You can pass the duration of the fade effect to the fadeout function. then