所以我正在尝试创建一个折叠框,如下图所示。我需要展示几个这样的盒子,但是当一个可折叠的盒子打开时我想隐藏其他盒子。尝试使用bootstrap崩溃,但看起来存在DOM结构必需的问题:https://github.com/twbs/bootstrap/issues/10966
有没有其他方法可以在没有javascript的情况下实现相同的行为?
这就是我的标记:
<div class="col-xs-12 col-sm-8 col-lg-10">
<div class="row">
<div class="col-xs-4 col-lg-2"><span class="text-uppercase">Var dates</span><span>$600.00</span><span><a data-target="#moreInfoPastAmount" data-toggle="collapse" aria-expanded="true" aria-controls="moreInfoPastAmount" data-parent="#moreInfo">+Past Amount</a></span></div>
<div class="col-xs-4 col-lg-2"><span class="text-uppercase">Var dates</span><span>$400.00</span><span><a data-target="#moreInfoLateFees" data-toggle="collapse" aria-expanded="true" aria-controls="moreInfoLateFees" data-parent="#moreInfo">+Late Fees</a></span></div>
<div class="col-xs-4 col-lg-2"><span class="text-uppercase">Mar 26</span><span>$200.00</span><span>Current Due</span></div>
</div>
<div id="moreInfo" class="row">
<div class="col-xs-12">
<div id="moreInfoPastAmount" class="arrow-box collapse in" aria-expanded="true">
<div class="arrow left"></div>
<p>Content goes here</p>
</div>
<div id="moreInfoLateFees" class="arrow-box collapse in" aria-expanded="true">
<div class="arrow left"></div>
<p>Content goes here</p>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
经过一些研究后,您只需要在.panel
div中添加一个#moreInfo
类,因为Bootstrap的崩溃数据中存在错误 - 父级 - https://github.com/twbs/bootstrap/issues/10966。
<div id="moreInfo" class="row">
<div class="panel col-xs-12"> <!-- Panel added here -->
<div id="moreInfoPastAmount" class="arrow-box collapse" aria-expanded="true">