2012-10-23 181 views
1

如何創建一個引導手風琴,當摺疊時,會摺疊兩個或更多的「兒童」手風琴? (相對於下面的網站演示只有一個)。

http://twitter.github.com/bootstrap/javascript.html#collapsebootstrap手風琴摺疊多個孩子?

+0

崩潰插件可以限制手風琴的數量開到1只,用'數據父'屬性。你能否更明確地說明你想要打開/關閉多少手風琴以及它們各自的行爲?無論如何,您可以輕鬆地將自己的處理程序綁定到任何崩潰事件。 – Sherbrow

回答

4

引導手風琴與 「孩子」 手風琴:
http://jsfiddle.net/MasterAlex/a8pVJ/113/

<div class="accordion" id="accordion1"> 
<div class="accordion-group"> 
    <div class="accordion-heading"> 
     <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"> 
      Collapsible Group Item #1 </a> 
    </div> 
    <div id="collapseOne" class="accordion-body collapse" style="height: 0px;"> 
     <div class="accordion-inner"> 
      collapseOne text 
      <div class="accordion" id="accordion2"> 
       <div class="accordion-group"> 
        <div class="accordion-heading"> 
         <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOneOne"> 
          Collapsible SubGroup Item #1 </a> 
        </div> 
        <div id="collapseOneOne" class="accordion-body collapse" style="height: 0px;"> 
         <div class="accordion-inner"> 
          collapseOneOne text 
         </div> 
        </div> 
       </div> 
       <div class="accordion-group"> 
        <div class="accordion-heading"> 
         <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOneTwo"> 
          Collapsible SubGroup Item #2 </a> 
        </div> 
        <div id="collapseOneTwo" class="accordion-body collapse" style="height: 0px;"> 
         <div class="accordion-inner"> 
          collapseOneTwo text 
         </div> 
        </div> 
       </div> 
       <div class="accordion-group"> 
        <div class="accordion-heading"> 
         <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOneThree"> 
          Collapsible SubGroup Item #3 </a> 
        </div> 
        <div id="collapseOneThree" class="accordion-body collapse"> 
         <div class="accordion-inner"> 
          collapseOneThree text 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
<div class="accordion-group"> 
    <div class="accordion-heading"> 
     <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo"> 
      Collapsible Group Item #2 </a> 
    </div> 
    <div id="collapseTwo" class="accordion-body collapse" style="height: 0px;"> 
     <div class="accordion-inner"> 
      collapseTwo text 
     </div> 
    </div> 
</div> 
<div class="accordion-group"> 
    <div class="accordion-heading"> 
     <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseThree"> 
      Collapsible Group Item #3 </a> 
    </div> 
    <div id="collapseThree" class="accordion-body collapse"> 
     <div class="accordion-inner"> 
      collapseThree text 
     </div> 
    </div> 
</div> 

+0

您的演示目前無法使用 – tom10271

+1

@aokaddaoc,已更新的鏈接 –