Bootstap模式中的Bootbox确认在模态后面发送滚动光标

时间:2016-01-07 12:36:17

标签: bootbox

我在bootstrap模式中使用bootbox.confirm。问题是背景是在模态背后。确认滚动控制后面的模态: enter image description here

代码:

$('.deleteFile').on('click',function(){
        var url=$(this).data('url');
        var parent=$(this).parent();
        bootbox.dialog({
            message: "Are you sure you want to delete this File?",
            title: "Alert",
            buttons: {
                success: {
                    label: "Yes",
                    className: "btn-success",
                    callback: function () {
                        $.get(url,function(res){
                            res=$.parseJSON(res);
                            if(res.err===0){
                                parent.remove();
                            }
                        });
                    }
                },
                danger: {
                    label: "No",
                    className: "btn-primary",
                    callback: function () {

                        bootbox.hideAll();
                    }
                }
            }
        });

    });

1 个答案:

答案 0 :(得分:1)

此代码对您有所帮助。 (函数(模态){         var show = Modal.prototype.show;

    Modal.prototype.show = function() {
      this.modalOpen = !this.$body.hasClass('modal-open');
      show.apply(this, arguments);
    };

    Modal.prototype.hideModal = function() {
      var that = this;
      this.$element.hide();
      this.backdrop(function() {
        if (that.modalOpen) {
          that.$body.removeClass('modal-open');
        }
        that.resetScrollbar();
        that.$element.trigger('hidden.bs.modal');
      });
    };
})($.fn.modal.Constructor);