Bootstrap 3 关闭Modal窗口 Close Bootstrap Modal

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" 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">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        
          
          <a class="custom-close"> My Custom Close Link </a>
          
          
      </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 -->

javascript:

$(function () {
    $(".custom-close").on('click', function() {
        $('#myModal').modal('hide');
    });
});

所以,可以尝试使用 $(‘#modal’).modal(‘toggle’); 或者  $(‘#modal’).modal(‘hide’);

更多参考:

Bootstrap 3: 菜单居中 Center content in responsive bootstrap navbar2016-08-08

Bootstrap 3: 使用注意box-sizing细节及解决方法

Bootstrap 3: 图标转换事件 Change icons when toggle

Bootstrap 3 : 实现5栏设计 5 columns layout with Twitter Bootstrap

Bootstrap 3 添加外部页面到弹出窗口Bootstrap 3 with remote Modal

Bootstrap 3: 无限级别下拉菜单 Multi level dropdown menu in Bootstrap 3

 

本文:Bootstrap 3 关闭Modal窗口 Close Bootstrap Modal

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.