我想在关闭此模式时触发一个事件。当我们点击关闭按钮或关闭按钮之外的任何地方时,模型就会关闭
<a href='#part-3' data-toggle='modal' id='sss' style='float:right; color:black;' >view</a></center>
//code for modal
<div class="modal modal-wide fade" id="part-3" >
<div class="modal-dialog" style="min-width:60%">
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" >×</button>
</div>
<div class="modal-body">
<div class="show">
//the html code of form which is popped up
</div>
</div>
</div>
</div>
当通过关闭按钮关闭模态时,我可以轻松地创建一个jquery事件,方法是给它一个id,但是当用户单击模态之外的任何地方时如何触发/该触发器的名称应该是什么..
最佳答案
在 Bootstrap 中,当模式关闭/隐藏时,JavaScript 事件已经触发:
$('#myModal').on('hide.bs.modal', function (e) {
// do something...
})
查看相关documentation here了解更多事件。
关于jquery - 如何在 Bootstrap 模式关闭时触发事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32383070/