How can I change the default width of a Twitter Bootstrap modal box?

后端 未结 30 2636
醉酒成梦
醉酒成梦 2020-11-27 08:38

I tried the following:

   
30条回答
  •  粉色の甜心
    2020-11-27 09:38

    I've found this solution that works better for me. You can use this:

    $('.modal').css({
      'width': function () { 
        return ($(document).width() * .9) + 'px';  
      },
      'margin-left': function () { 
        return -($(this).width() / 2); 
      }
    });
    

    or this depending your requirements:

    $('.modal').css({
      width: 'auto',
      'margin-left': function () {
         return -($(this).width() / 2);
      }
    });
    

    See the post where I found that: https://github.com/twitter/bootstrap/issues/675

提交回复
热议问题