Collapsable Navigation Menu with Unlimited Levels


/ Published in: jQuery
Save to your folder(s)

A lightweight, collapsable menu script that works no matter how many nested lists there are.


Copy this code and paste it in your HTML
  1. $('#container ul li a').click(function() {
  2. if ( $(this).parent().children('ul').size() > 0 ) {
  3. $(this).parent().children('ul:first').toggle();
  4. $(this).parent().siblings().find('ul:visible').hide();
  5. }
  6. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.