Keep the 'accordion' menu open
Hay,
I've got an question about a 'accordion menu',
When I add a 'current' class to my list item,
- <ul id="TEST">
- <li><a href="#">Example 1</a>
- <ul>
- <li><a href="#">Example 1.1</a></li>
- <li><a href="#">Example 1.2</a></li>
- </ul></li>
- <li><a href="#">Example 2</a>
- <ul>
- <li><a href="#">Example 2.1</a></li>
- <li class="current"><a href="#">Example 2.2</a></li>
- </ul></li>
- </ul>
I'd like the the 'current' menu item stays open on the
new page.
What line of code do I have to add in the Jquery code?
- $(document).ready(function(){
- $('#TEST ul > li ul')
- .click(function(e){
- e.stopPropagation();
- })
- .hide();
-
- $('#TEST ul > li').click(function(){
- var selfClick = $(this).find('ul:first').is(':visible');
- if(!selfClick) {
- $(this)
- .parent()
- .find('> li ul:visible')
- .slideToggle();
- }
-
- $(this)
- .find('ul:first')
- .stop(true, true)
- .slideToggle();
- });
- });
I'm looking forward to your response.
YB