本文介绍了折叠插件:一次只显示一个面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很难弄清楚这一点,也许我只是没有搜索正确的术语.
我有一个常规的 Twitter 折叠面板.我只希望它一次显示一个面板.
默认情况下,它允许您一次打开所有面板,但我希望它在您展开另一个面板时自动关闭任何其他打开的面板.
http://twitter.github.com/bootstrap/javascript.html#collapse
<div class="accordion-group"><div class="accordion-heading"><div class="accordion-toggle" data-toggle="collapse" data-parent="monogram-acc" href="#Animals">动物
<div class="accordion-body collapse" id="Animals">//... 内容
<div class="accordion-group"><div class="accordion-heading"><div class="accordion-toggle" data-toggle="collapse" data-parent="monogram-acc" href="#Food">食物
<div class="accordion-body collapse" id="食物">//... 内容
//... 很快
http://jsfiddle.net/AbtmY/
解决方案
http://jsfiddle.net/AbtmY/1/一个>
改变
data-parent="monogram-acc"
到
data-parent="#monogram-acc"
I'm having a hard time figuring this out, and maybe I'm just not searching the right terms.
I have a regular twitter collapse panel. I only want it to show one panel at a time.
By default, it allows you to open all of the panels at once, but I want it to automatically close any other open panel when you expand another one.
http://twitter.github.com/bootstrap/javascript.html#collapse
<div class="accordion" id="monogram-acc">
<div class="accordion-group">
<div class="accordion-heading">
<div class="accordion-toggle" data-toggle="collapse" data-parent="monogram-acc" href="#Animals">
Animals
</div>
</div>
<div class="accordion-body collapse" id="Animals">
//... content
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<div class="accordion-toggle" data-toggle="collapse" data-parent="monogram-acc" href="#Food">
Food
</div>
</div>
<div class="accordion-body collapse" id="Food">
// ... content
</div>
</div>
//... so on
</div>
http://jsfiddle.net/AbtmY/
解决方案
http://jsfiddle.net/AbtmY/1/
Change
data-parent="monogram-acc"
to
data-parent="#monogram-acc"
这篇关于折叠插件:一次只显示一个面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-06 01:44