WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => jQuery => Topic started by: friet on October 08, 2009, 01:58:34 PM

Title: Jquery accordion - active element
Post by: friet on October 08, 2009, 01:58:34 PM
I'm using the show_menu2 function to make a jquery accordion menu.
My menu looks like this:

Page1
-Subpage1
-Subpage2
Page2
-Subapge3
etc...

You get the idea.
This is my accordion code:
Code: [Select]
<script type="text/javascript">
  $(document).ready(function(){
    $("#accordion").accordion({ autoHeight: false });
  });
</script>
and the menu code:
Code: [Select]
$menuestring1='[if(level==3){<h3><a href="#">[menu_title]</a></h3>} else {<li><a href="[url]">[menu_title]</a></li>}]';
                            $menuestring2='[if(level>3){<div><ul>}]';
                            show_menu2(0,SM2_ROOT+3,SM2_START+2,SM2_ALL|SM2_PRETTY,$menuestring1,'',$menuestring2,'</ul></div>','','');

It's based on some code i got from the forum.

Now the problem is, when i click on subpage 3, I want the second accordion-part to be open when my browser loads that page. In the accordion you can define what part should be open (with active: <number>) but how do I detect on what subpage I clicked thus what accordionpart should be opened?