我有一些按钮可以展开和折叠div。我需要添加一些javascript,在展开一个之前折叠所有展开的div。
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"/>
<button class="btn btn-secondary"
data-bs-toggle="collapse" data-bs-target="#resize-form"
aria-expanded="false" aria-controls="resize-form" title="Resize">
Resize
</button>
<button class="btn btn-secondary"
data-bs-toggle="collapse" data-bs-target="#brightness-form"
aria-expanded="false" aria-controls="resize-form" title="Resize">
Brightness
</button>
<div id="resize-form" class="collapse bg-primary p-4" style="background: red">
<p>Resize</p>
</div>
<div id="brightness-form" class="collapse bg-secondary p-4">
<p>
Brightness
</p>
</div>
在扩展之前需要什么来折叠所有打开的对象?
1条答案
按热度按时间rekjcdws1#