bootstrap 模态框(modal)实现垂直居中显示

找到bootstrap.js,搜索 that.enforceFocus() ,然后在其下面添加如下代码:

that.$element.children().eq(0).css("position", "absolute").css({
	"margin":"0px",
	"top": function () {
			return (that.$element.height() - that.$element.children().eq(0).height()-40) / 2 + "px";
	},
	"left": function () {
			return (that.$element.width() - that.$element.children().eq(0).width()) / 2 + "px";
	}
});

参考:https://www.cnblogs.com/ly-radiata/articles/4974928.html


29 Clicks !

发表评论

电子邮件地址不会被公开。 必填项已用*标注