2015-01-14 22 views
0

我試圖在Foundation(5.5.0版)中設置手風琴的格式,但它只是顯示每個部分的標題,沒有任何獲取下面內容的方法。我究竟做錯了什麼?我的HTML低於:未在基金會工作的手風琴

的Html

<div class="section-container accordion" data-section="accordion"> 
    <section class="active"> 
     <p class="title" data-section-title><a href="#">Section 1</a> 
     </p> 
     <div class="content" data-section-content> 
      <p>Content of section 1.</p> 
     </div> 
    </section> 
    <section> 
     <p class="title" data-section-title><a href="#">Section 2</a> 
     </p> 
     <div class="content" data-section-content> 
      <p>Content of section 2.</p> 
     </div> 
    </section> 
</div> 

的Javascript

$(document).foundation(); 

Example

+0

您需要解釋您的問題。你是什​​麼意思? – Mehmet

+0

您是否使用了doctype聲明? –

+0

@NaeemShaikh我沒有得到所需的格式。我得到的僅僅是4行,「第1節 第1節的內容。 第2節 第2節的內容」 –

回答

2

整整花了我一段時間來弄明白,但我得到的示例工作:

Section - 實例您發佈似乎只與基金會4.x版本工作

請參閱this示例。 (請注意我用的是外部資源)

在版本>基金會4有一個accordion -Functionality:

HTML

<ul class="accordion" data-accordion> 
    <li class="accordion-navigation"> 
     <a href="#panel1a">Accordion 1</a> 
     <div id="panel1a" class="content active">...</div> 
    </li> 
//and so on 
</ul> 

的Javascript

$(document).ready(function(){ 
    $(document).foundation(); 
}); 

Demo

P.S.我使用this網站獲得不同版本的基礎

0
<div class="section-container accordion"> 
    <p class="title"> 
    <a href="#">Section 1</a> 
    </p> 
    <div class="content"> 
    <p> 
     Content of section 1. 
    </p> 
    </div> 
    <p class="title"> 
    <a href="#">Section 2</a> 
    </p> 
    <div class="content"> 
    <p> 
     Content of section 2. 
    </p> 
    </div> 
</div> 

你應該格外小心格式化。

+0

我試過了,但還是不行。 –

+0

然後你的JavaScript鏈接不好,或者瀏覽器找不到它。 Tri在頁面上右擊 - > Inspect Element,然後你會發現什麼是錯的。 –

+0

你可以檢查鏈接http:// flickspedia。com/ –