我在Bootstrap 3中看到,手风琴的默认功能是在打开其他可折叠元素时将其关闭。
是否可以使用折叠来执行此操作?
<div class="collapse" id="collapse5">
<p> venenatis tincidunt. Fusce at dolor nunc.
Duis maximus pulvinar leo, id laoreet massa tincidunt ut.
Quisque scelerisque sit amet ipsum eget ornare.
Donec eu blandit lectus. Suspendisse potenti.
Praesent posuere enim sapien. Etiam et ullamcorper sem.
Nam quis leo eu enim porttitor mattis vitae vel libero.
Curabitur feugiat nec nulla quis luctus.
</p>
</div>
<button class="btn my-btn" type="button" data-toggle="collapse" data- target="#collapse5" aria-expanded="false" aria-controls="collapseExample" onclick="this.classList.toggle('open2')">
</button>
基本上按钮会打开可折叠的DIV,但是可以说id 5是否打开,关闭其他4?
或者我应该将这些元素转换为手风琴?
答案 0 :(得分:0)
If you dont want to use accordian then you must place onclick event on other buttons or you can use accordian
检查此fiddle是否为bootstrap accordian