2

I'm using the following component: http://www.jqueryscript.net/menu/Lightweight-Drilldown-Menu-Plugin-with-jQuery-Bootstrap.html

I want to adjust the some built-in functionality: when an item from the lowest level is clicked,

  1. the menu closes.
  2. when opened again, the menu goes back to the last level that was accessed, as in the level where the last item was clicked before the menu closes.

I would like to prevent that the menu closes @ event 1. & I would like to jump back to the 'main menu' as in the highest level of the menu.

I know i have to look in the 'bootstrap-drilldown-select.js' file, but could anyone perhaps shine some light on how this code exactly works and where i should put my adjustments?

Thanks in advance!!

Edit 1 For the redirect to main menu (2.): I found out that the difference between a list item which allows a drilldown to a deeper level, has the class 'hasChild' added to it. @'bootstrap-drilldown-select.js' line 107-108. I think that there is an on-click event (somewhere) that checks whether or not the clicked item has a 'hasChild' class. If not, the event defined by 'onSelected' is fired. The only thing I'm still looking for is, where this event is. Any suggestions/help?

Because I couldn't find this event, I thought that I might call the initialize function when the 'onSelected' event is fired. Kinda like line 26-43, or more precies line 35 @ 'bootstrap-drilldown-select.js'. However, I'm not able to reach the function 'makeDropdown' from my external js-file. Any comments/advice on this note?

Atoq
  • 33
  • 7

1 Answers1

1

I found that redirect to main menu after selected one item, just call the function makeDropdown after this line: defaults.onSelected(event);

if (!data) {
  defaults.onSelected(event);
  makeDropdown(element, null, '', true); //this returns to main menu
  element.dropdown('toggle');
  isVisible = false;

  return false;
}

The third variable in this function is the path, so if this is empty, it returns to the original data, like this line when the element is created:

/* create a dropdown object */
makeDropdown(element, null, '', false);

I hope that helps you in your investigation.

Kursad Gulseven
  • 1,978
  • 1
  • 24
  • 26
Ryuzaki
  • 11
  • 1