必要なものを取得するには、確かに「data-parent」を設定する必要がありますが、これには「.panel」クラスも必要であることに注意してください。ドキュメントから:
セレクターが提供されている場合、この折りたたみ可能なアイテムが表示されると、指定された親の下にあるすべての折りたたみ可能な要素が閉じられます。(従来のアコーディオンの動作と同様 - これはパネル クラスに依存します)
デモ: http://www.bootply.com/qhs4dQbFZK
そのため、折りたたみ可能なアイテムを.panel
クラスでラップする (またはプラグインを変更する) 必要があります。参照: https://github.com/twbs/bootstrap/issues/15341
次に、折りたたみ可能なアイテムは次のようになります。
<div class="panel">
<div class="col-md-2 collapse" id="collapse1">
<div class="btn-group-vertical btn-block" data-toggle="buttons">
<button class="btn btn-default btn-lg" href="">First subtitle column</button>
<button type="button" class="btn btn-default btn-lg" data-toggle="collapse" href="#collapse1-1"><input type="radio" name="subtitle" id="st11">Subtitle 1-1</button>
<button type="button" class="btn btn-default btn-lg" data-toggle="collapse" href="#collapse1-2"><input type="radio" name="subtitle" id="st12">Subtitle 1-2</button>
<button type="button" class="btn btn-default btn-lg" data-toggle="collapse" href="#collapse1-3"><input type="radio" name="subtitle" id="st13">Subtitle 1-3</button>
</div>
</div>
</div>
ボタンは次のdata-parent
属性を取得する必要があります。
<button type="button" class="btn btn-default btn-lg" data-toggle="collapse" data-parent="#menurow" href="#collapse1"><input type="radio" name="title" id="title1">Title 1</button>
また、アイテムは ( #menurow
)の前に設定された id 内にラップする必要があります。
<div class="row" id="menurow"></div>
クラスはいくつかのスタイル ルールも設定していることに注意して.panel
ください。これは、状況に応じて上書き (元に戻す) する必要があります。たとえば、次のようになります。.panel {margin-bottom: 0;}