我希望只有在用户点击关闭按钮时,才能关闭模态框。据我所见,我需要重写 modal.js 中的这部分代码:
hide: function (e) {
e && e.preventDefault()
var that = this
e = $.Event('hide')//if I delete this line modal won't hide
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
$('body').removeClass('modal-open')
escape.call(this)
this.$element.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
我是否走在正确的道路上?
data-
属性:<div class="modal fade" data-keyboard="false" data-backdrop="static">
- WOUNDEDStevenJones