修改Bootstrap弹框不垂直居中问题

This commit is contained in:
Argo-Lenovo 2017-03-16 20:02:30 +08:00
parent 53b79a6c85
commit 8454c184b1
2 changed files with 2391 additions and 2381 deletions

View File

@ -344,6 +344,20 @@
}
}
});
//fix bug
$.fn.modal.Constructor.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
// added by Argo
var $modal_dialog = $(this.$element[0]).find('.modal-dialog');
$modal_dialog.adjustDialog();
}
})(jQuery);
$(function () {

View File

@ -1,4 +1,4 @@
/*!
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under the MIT license
@ -35,10 +35,10 @@ if (typeof jQuery === 'undefined') {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
@ -1163,10 +1163,6 @@ if (typeof jQuery === 'undefined') {
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
// added by Argo
var $modal_dialog = $(this.$element[0]).find('.modal-dialog');
$modal_dialog.adjustDialog();
}
Modal.prototype.resetAdjustments = function () {