简体   繁体   English

Bootstrap模式在内容更改时调整大小

[英]Bootstrap Modal Resize on Content Change

I have a bootstrap modal window which contains a form. 我有一个包含表格的bootstrap模态窗口。 If the user submits the form, it gets validated via Ajax. 如果用户提交表单,它将通过Ajax进行验证。 If there is any error it is shown above the form in the modal (without reloading the page). 如果有任何错误,它会显示在模态中的表单上方(不重新加载页面)。

Thus, i need a way to resize the modal when the content changes. 因此,我需要一种方法来在内容更改时调整模式的大小。 Any ideas? 有任何想法吗?

你试过不设置div的高度吗?

I have the same problem. 我也有同样的问题。 I just remove the max-height. 我只是删除了最大高度。

.modal-body {
  overflow-y: auto;
  /*max-height: 400px;*/
  padding: 15px;
}

As the latter answer suggests to edit a core css definition, I would discourage this, it is bad practice. 由于后者的答案建议编辑核心css定义,我会劝阻这个,这是不好的做法。 In whatever.css you can use CSS Point Score to overwrite it like so: whatever.css中,您可以使用CSS Point Score覆盖它,如下所示:

div.modal-body {
    overflow-y: auto;
    max-height: none;
    padding: 15px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM