Note that there are some explanatory texts on larger screens.

plurals
  1. POCollapsed jQuery UI Accordion within Wordpress
    primarykey
    data
    text
    <p>I'm trying to achieve collapsed accordion on a page load, unless someone goes to a specific tab. I've got accordion working, but can't get it to collapse. I'm using Wordpress platform and my template displays output like this:</p> <pre><code>&lt;div id="accordion" class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons" role="tablist"&gt; &lt;section class="post-4 page type-page status-publish hentry clearfix"&gt; &lt;h1 class="entry-title acc-header dark-side ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" role="tab" aria-expanded="true" aria-selected="true" tabindex="0"&gt;&lt;span class="ui-icon ui-icon-triangle-1-s"&gt;&lt;/span&gt;&lt;a href="#"&gt;Boon Villas – it is all about partnership&lt;/a&gt;&lt;/h1&gt; &lt;div class="the-content dark-side ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="height: 368px; display: block; " role="tabpanel"&gt; Some content 1 &lt;/div&gt;&lt;!-- end #the-content--&gt; &lt;/section&gt; &lt;section class="post-4 page type-page status-publish hentry clearfix"&gt; &lt;h1 class="entry-title acc-header dark-side ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" role="tab" aria-expanded="false" aria-selected="false" tabindex="-1"&gt;&lt;span class="ui-icon ui-icon-triangle-1-e"&gt;&lt;/span&gt;&lt;a href="#6" id="6"&gt;Our Commitment&lt;/a&gt;&lt;/h1&gt; &lt;div class="the-content dark-side ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" style="height: 368px; display: none; " role="tabpanel"&gt; Some content 2 &lt;/div&gt;&lt;!-- .the-content --&gt; &lt;/section&gt; &lt;section class="post-4 page type-page status-publish hentry clearfix"&gt; &lt;h1 class="entry-title acc-header dark-side ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" role="tab" aria-expanded="false" aria-selected="false" tabindex="-1"&gt;&lt;span class="ui-icon ui-icon-triangle-1-e"&gt;&lt;/span&gt;&lt;a href="#10" id="10"&gt;Our People&lt;/a&gt;&lt;/h1&gt; &lt;div class="the-content dark-side ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" style="height: 368px; display: none; " role="tabpanel"&gt; Some content 3 &lt;/div&gt;&lt;!-- .the-content --&gt; &lt;/section&gt; &lt;section class="post-4 page type-page status-publish hentry clearfix"&gt; &lt;h1 class="entry-title acc-header dark-side ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" role="tab" aria-expanded="false" aria-selected="false" tabindex="-1"&gt;&lt;span class="ui-icon ui-icon-triangle-1-e"&gt;&lt;/span&gt;&lt;a href="#17" id="17"&gt;Languages Spoken&lt;/a&gt;&lt;/h1&gt; &lt;div class="the-content dark-side ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" style="height: 368px; display: none; " role="tabpanel"&gt; Some content 4 &lt;/div&gt;&lt;!-- .the-content --&gt; &lt;/section&gt; &lt;/div&gt; </code></pre> <p>My jQuery is:</p> <pre><code> var accOpt = { active: false, header: '.acc-header', navigation: true, event: 'mouseover', fillSpace: false, animated: 'easeslide', collapsible: true, allwayOpen: false }; var accTab = &lt;?php if ( !$_GET['id']) { echo 0;} else {echo $_GET['id'];} ?&gt;; $(document).ready(function(){ $('#accordion').accordion( accOpt ); $("#accordion").accordion( 'activate', accTab ); }); </code></pre> <p>I'm using the PHP to get the id parameter from link to decide which tab should be open. Question is how to achieve all tabs collapsed if there is no id or id=0 => first tab.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload