来源:3-10 弹出框制作

蚊子漫布

2014-10-31 16:40

怎样让模态框居中呢?现在只能设置居上居下,但不能垂直居中,可以做到垂直居中吗???

写回答 关注

1回答

  • purple_yao
    2014-10-31 18:40:06
    已采纳

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

    robin6...

    试了,不管用啊。。。。

    2015-01-16 22:48:07

    共 1 条回复 >

基于bootstrap的网页开发

Bootstrap框架的基础教程,学会用Bootstrap前端框架搭建网页

187653 学习 · 760 问题

查看课程

相似问题