TinyNav.js icon indicating copy to clipboard operation
TinyNav.js copied to clipboard

Specify depth of navigation

Open LRotherfield opened this issue 11 years ago • 3 comments

I have been working on a project that has a mega menu and also a side menu. Because of the duplicate navigation I only wanted the top navigation to show the first level of nav once its made into a select. The alterations in this pull request add another settings key "depth" which allows the developer to set a specific depth to iterate to.

An example:

$(".navigation_one > ul").tinyNav({
  active: 'current',
  depth: 2
});

LRotherfield avatar Mar 11 '13 15:03 LRotherfield

+1

Nicely done.

bigsweater avatar Mar 29 '13 21:03 bigsweater

There's a bug with the implementation, please see #39

ghost avatar Apr 04 '13 07:04 ghost

I would recomend to do it by update a library on line 40 Change: options += '<option value="' + $(this).attr('href') + '">'; To: options += '<option value="' + $(this).attr('href') + '" class="menuLevel-'+ $(this).parents('ul, ol').length +'">';

Then all options have own class with level specification: class="menuLevel-1" class="menuLevel-2" class="menuLevel-3"

And you can easy hide them in css: .menuLevel-3{ display:hide; }

magmanoid avatar Feb 16 '18 12:02 magmanoid