How to remove slide down effect from Bootstrap modal

Topic: Bootstrap / Less« Prev|Next »

Answer: Remove the fade Class from Modal

By default, on activation the Bootstrap modal window is displayed after a short slide down transition. However, if you don't like this and want to remove the animation just take out the fade class from the .modal element. Here's an example.

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="UTF-8">
  • <title>Remove Slide Animation from Bootstrap Modals</title>
  • <link rel="stylesheet" href="css/bootstrap.min.css">
  • <link rel="stylesheet" href="css/bootstrap-theme.min.css">
  • <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
  • <script src="js/bootstrap.min.js"></script>
  • </head>
  • <body>
  •     <!-- Button HTML (to Trigger Modal) -->
  •     <a href="#myModal" class="btn btn-lg btn-primary" data-toggle="modal">Launch Demo Modal</a>
  •     
  •     <!-- Modal HTML -->
  •     <div id="myModal" class="modal">
  •         <div class="modal-dialog">
  •             <div class="modal-content">
  •                 <div class="modal-header">
  •                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  •                     <h4 class="modal-title">Confirmation</h4>
  •                 </div>
  •                 <div class="modal-body">
  •                     <p>Do you want to save changes you made to document before closing?</p>
  •                     <p class="text-warning"><small>If you don't save, your changes will be lost.</small></p>
  •                 </div>
  •                 <div class="modal-footer">
  •                     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  •                     <button type="button" class="btn btn-primary">Save changes</button>
  •                 </div>
  •             </div>
  •         </div>
  •     </div>    
  • </body>
  • </html>

Related FAQ

Here are some more FAQ related to this topic:

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.