javascript - 如何在关闭 Bootstrap 3 模式时重新加载页面

标签 javascript jquery twitter-bootstrap twitter-bootstrap-3

我的目标是让页面在 Bootstrap 模式关闭时重新加载。用户可以通过单击关闭按钮或图标或单击远离模态来关闭模态。

到目前为止,我的代码非常标准。摘自: http://getbootstrap.com/javascript/#modals

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

<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">My title</h4>
      </div>
      <div class="modal-body">
        My content
      </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</button>
      </div>
    </div>
  </div>
</div>

如何让页面在模式关闭后重新加载?

更新:哇,每个人的 react 都非常快。谢谢

最佳答案

您可以绑定(bind)事件以在点击关闭时重新加载页面:

$('#myModal').on('hidden.bs.modal', function () {
 location.reload();
})

Demo

关于javascript - 如何在关闭 Bootstrap 3 模式时重新加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21578315/

相关文章:

没有过期日期的 Javascript Cookie

javascript - 垂直平移 Google 柱形图

php - 为什么页脚包含在容器中?

javascript - Node 快速返回带有链接的消息

javascript - 匹配 CSS RGB 颜色值

javascript - 使 Iframe 高度适合其内容

javascript - 更改选择菜单内的文本颜色

html - 在 Jumbotron 中创建背景图像

css - Bootstrap 4( Angular )导航栏折叠按钮不起作用

javascript - 如何用三元运算输出三个结果的值