Bootstrap多模态框无法点击滑动解决方案

版权声明:Copyright© 2017 Matt.Jason.Lu, Allrights Reserved. https://blog.csdn.net/lujiachun1/article/details/86690182

多模态框,先前模态框无法滑动
增加以下语句即可解决

// 覆盖Modal.prototype的hideModal方法
$.fn.modal.Constructor.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
        //判断当前页面所有的模态框都已经隐藏了之后body移除.modal-open,即body出现滚动条。
        $('.modal.fade.in').length === 0 && that.$body.removeClass('modal-open');
        that.resetAdjustments();
        that.resetScrollbar();
        that.$element.trigger('hidden.bs.modal')
    })
};

猜你喜欢

转载自blog.csdn.net/lujiachun1/article/details/86690182