that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
/***************************************************************/
var $modalDialog = that.$element.find(".modal-dialog"),
dialogHeight = $modalDialog.height(),
windowHeight = $(window).height();
// When dialog height greater than window height,
// use default margin top value to set dialog position.
// if (windowHeight < dialogHeight) {
// do nothing
// return;
// }
// When dialog height less than window height,
// use margin top set it position.
// Dialog position set it with vertical center.
if (windowHeight > dialogHeight) {
$modalDialog.css({
"marginTop": ( windowHeight - dialogHeight) / 2
});
}
/**************************************************************/
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
块级注释间为增加代码,在bootstrap.js中
https://my.oschina.net/jak/blog/387693
以下为天堂向左补充
对于bootstrap 3.3.5版本,注意这一行的 that
that.enforceFocus()
在bootstrap.min.js中可能需要将 that 换成 d: