Bootstrap(v3.2.0)模态框(modal)垂直居中

Bootstrap(v3.2.0)模态框(modal)垂直居中方法:

在bootstrap.js文件900行后面添加如下代码,便可以实现垂直居中。

 

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";
          }
      });

 

posted @ 2014-10-22 12:32  Java碎碎念  阅读(762)  评论(0编辑  收藏  举报