Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Accordion to activate specific panels with anchor tags/url hash
    primarykey
    data
    text
    <p>I am having an almost identical problem to the question asked here ( <a href="https://stackoverflow.com/questions/588030/link-to-open-jquery-accordion">Link to open jQuery Accordion</a>? ) but wasn't able to correctly implement the answers.</p> <p>I tried this solution but it didn't work for me:</p> <pre><code>$("#accordion").accordion("activate", &lt;?php echo $_GET['id']; ?&gt;); </code></pre> <p>I have a Jquery accordion with the following code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ // Accordion $("#accordion").accordion({ header: "h3", autoHeight: false, navigation: true, collapsible: true, active: false }); $(".exlnk").click(function(event){ window.location.hash=this.hash; }); }); &lt;/script&gt; &lt;script type="text/javascript"&gt; function Click1(){ $("#accordion").accordion('activate' , 0) } function Click2(){ $("#accordion").accordion('activate' , 1) } &lt;/script&gt; </code></pre> <p>Simplified HTML:</p> <pre><code> &lt;h3&gt;&lt;a class="exlnk" href="#about" title="About"&gt;About&lt;/a&gt;&lt;/h3&gt; &lt;div&gt;content blah blah&lt;/div&gt; &lt;h3&gt;&lt;a class="exlnk" href="#about" title="About"&gt;About&lt;/a&gt;&lt;/h3&gt; &lt;div&gt;Blah blah&lt;/div&gt; </code></pre> <p>The above code allows me to have links on the main page that will activate the specified panel.</p> <p>The exlnk bit gives each panel a hash upon clicking it, which I read on this tutorial ( <a href="http://www.michaeljacobdavis.com/tutorials/statesavingaccordion.html" rel="nofollow noreferrer">http://www.michaeljacobdavis.com/tutorials/statesavingaccordion.html</a> ) would create state-saving, book-markable panels. It assigns the hash, but it doesn't activate the panels or save them from closing on re-load. </p> <p>What I want is to be able to link externally to <a href="http://www.mysite.com/page#anchor" rel="nofollow noreferrer">http://www.mysite.com/page#anchor</a> and have it open the page with the appropriate panel open. My work-around to be able link from the accordion page is only so useful!</p> <p>Thanks SO MUCH for any help...I have read every Q&amp;A on this site related to the Accordion script and was not able to make any of the answers work. I am very very new to Jquery/Javascript, so answers that explain all the steps of implementation and where to place each suggested code would be wonderful.</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.
 

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