2016-02-28 238 views
0

我想在頁面加載時激活所有Accordion Tabs手風琴:打開所有標籤頁

jQuery(document).ready(function($) { 
 
     jQuery(".accordion").accordion({heightStyle: "content", collapsible: true, active: 0}); 
 
    });
<div class="accordion" id="accordion">   
 
    <h3>This is Title 1</h3> 
 
    <div> 
 
    <p>This is Content 1</p> 
 
    </div>  
 

 
    <h3>his is Title 2</h3> 
 
    <div> 
 
    <p>This is Content 2</p> 
 
    </div>  
 
</div>

回答

0

所有你錯過了只是包括jQuery的文件。

添加下面一行在<head>標籤

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 

<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"></script> 

那麼它西港島線將取決於後我們,我們要如何管理手風琴。

+0

你好,Punit,沒有jquery和jquery-ui手風琴將無法正常工作。我想要打開所有的手風琴標籤。 –

+0

嘿@LitonArefin如果你想展開所有的話,你不應該使用手風琴..更好地使用展開/摺疊全部。它會更好..檢查[這](http://jsfiddle.net/sinetheta/s5hAw/)的例子。 –

+1

得到了使用「可摺疊」的解決方案。用於[「WP Awesome FAQ Pro」](https://jeweltheme.com/product/wordpress-faq-plugin/)插件。謝謝 –