4
在引导,当你做如下崩塌效应:为什么bootstrap都需要类名和Id名称来折叠?
<p>
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Link with href
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Button with data-target
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-block">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
</div>
</div>
为什么按钮引用类data-toggle=collapse
及ID面板效果的data-target=#collapseExample
?没有足够的ID来切换其状态?
是因为数据切换指的是它将要使用哪种效果因此将面板与它一起定位?
非常感谢!它让我感到困惑,因为类名也被命名为'collapse',我最终认为它也是针对类名的。 – Chopnut