最近一个项目中需要用到模态窗口,试用了几个都不是很好,最后选用的Bootstrap的Modal模态窗口,效果如下,
但是有一个问题就是,不能实现居中,查了一些资料解决了这个问题,实现居中显示,打开Bootstrap.js 大概在900 行左右的位置,插入下面的代码,问题解决~
//扩展--居中 10-16
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";
}
});