【发布时间】:2018-06-15 01:48:56
【问题描述】:
我有以下手风琴,并希望允许用户使用 jQuery 单击按钮来展开所有手风琴选项卡。
我尝试过使用这种方法 (https://codepen.io/dikuw/pen/KgzvJp),但手风琴位于 Kendo 自定义编辑模板弹出窗口中,它不会展开所有面板,而是切换第一个和第二个面板的打开。
<div class="panel-group" id="accordion-demo" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" class="panel-title" data-toggle="collapse" data-parent="#accordion-demo" href="#prerequisites" aria-expanded="true" aria-controls="prerequisites">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="prerequisites" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="prerequisites">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
<a class="collapsed panel-title" role="button" data-toggle="collapse" data-parent="#accordion-demo" href="#addwizard" aria-expanded="false" aria-controls="addwizard">
Collapsible Group Item #2
</a>
</h4>
</div>
<div id="addwizard" class="panel-collapse collapse" role="tabpanel" aria-labelledby="addwizard">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a class="collapsed panel-title" role="button" data-toggle="collapse" data-parent="#accordion-demo" href="#adjusthtml" aria-expanded="false" aria-controls="adjusthtml">
Collapsible Group Item #3
</a>
</h4>
</div>
<div id="adjusthtml" class="panel-collapse collapse" role="tabpanel" aria-labelledby="adjusthtml">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
</div>
</div>
【问题讨论】:
-
你在用 angularjs 吗?因为你提到的例子是在 angularjs 中。
-
我不这么认为。我想要做的就是展开用户单击按钮时不可见的面板。我很困惑为什么这不起作用: $('.panel-collapse:not(".in")') .collapse('show');
标签: javascript jquery twitter-bootstrap bootstrap-4 kendo-asp.net-mvc