bootstrap3 设置modal弹出垂直剧中

c.prototype.adjustDialog =function () {

var a =this.$element[0].scrollHeight >document.documentElement.clientHeight;

this.$element.css({

paddingLeft: !this.bodyIsOverflowing &&a ?this.scrollbarWidth :"",

paddingRight:this.bodyIsOverflowing && !a ?this.scrollbarWidth :""

    })

// 设置modal弹出垂直剧中

    var $modal_dialog =$(this.$element[0]).find('.modal-dialog');

    var m_top = ($(window).height() -$modal_dialog.height() )/2;

     $modal_dialog.css({'margin':m_top +'px auto'});

}


在 c.prototype.adjustDialog =function () 函数内部,如图所示的位置加上以下三行

    var $modal_dialog =$(this.$element[0]).find('.modal-dialog');

    var m_top = ($(window).height() -$modal_dialog.height() )/2;

     $modal_dialog.css({'margin':m_top +'px auto'});

你可能感兴趣的:(bootstrap3 设置modal弹出垂直剧中)