我的目标是让页面在 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">×</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();
})
关于javascript - 如何在关闭 Bootstrap 3 模式时重新加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21578315/