twitter-bootstrap Bootstrap 手风琴折叠高度问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13280982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 15:40:17  来源:igfitidea点击:

Bootstrap accordion collapse height issue

twitter-bootstrap

提问by djcamo

i have been using the collapse module for a while but have now found an issue with items that are quite long eg. more than a few paragraphs.

我一直在使用折叠模块一段时间,但现在发现很长的项目存在问题,例如。多几段。

It seems that depending upon the number of items you have a height attribute is added to the outermost div as per below:

似乎根据您具有高度属性的项目数量添加到最外面的 div,如下所示:

 div class="accordion in collapse" id="accordion2" style="height: 348px;"

So when you expand an item it only expands to the height given above. If I un-check this whilst in developer mode it all works perfectly.

所以当你展开一个项目时,它只会扩展到上面给出的高度。如果我在开发人员模式下取消选中此项,则一切正常。

What I can't find is where in the bootstrap.js it adds this style attribute.

我找不到的是在 bootstrap.js 中添加此样式属性的位置。

采纳答案by Costa

Try

尝试

$('#accordion2').collapse('show').height('auto');

回答by yorkfx

I work myself

我自己工作

.collapse.in {
      height: auto !important;
}