Collapsible menu

Collapsible menu

Hello everybody,

i'm new to jQuery and even after reading tutorials, examples and the references again and again i'm not able get this thing working. Buckwheats!!! Obviously i simply don't have the full understanding of JS / jQuery.

What i want to do:

- a collapsible menu made of <ul> and <li>
- the first and second level are always visible
- unrelated sublevels close if another sublevel is opened (e.g. clicking on Page 1 - 2 closes subpages of Page 1 - 1)
- only the 1st child is shown (lets say i have the 4th level open (Page 1 - 1 - 1 - n) and now click on the 2nd level (Page 1 - 1) - the 3rd level (Page 1 - 1 - 1) remains visible, but the 4th level closes)

Here's my approach. The submenus open, but they don't close. Could you please give me a hint?

http://www.wavr.de/collapsiblemenu/


Thank you!