sainture
6/9/2015 - 2:46 PM

Bootstrap 3 Modals

Bootstrap 3 Modals

  <!-- Button trigger modal -->
  <a data-toggle="modal" href="#myModal1" class="btn btn-primary btn-lg">Launch demo modal</a>
  <!-- Instead of using href in the button link you can also use the data-target attribute and give it the same value. -->

  <!-- Modal -->
  <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
          <h4 class="modal-title">Modal title</h4>
        </div>
        <div class="modal-body">
          ...
        </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><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->
  
<!-- Notes 
  *Custom attributes like aria-labelledby and aria-hidden in the parent modal element are used for accessibility. 
  *Add a modifier class modal-lg to the modal-dialog div for a larger modal or modal-sm for a smaller modal.
  
  *To change the Modal position in the viewport you can target the Modal div id, in this example the id is myModal3
  #myModal3 {
    top:5%;
    right:50%;
    outline: none;
  }
  The modal is by default positioned using fixed positioning, so it is fixed to the dimensions of the viewport.
  -->