In some cases, I like an expanded menu to collapse automatically when another menu item is clicked. The settings page should have an option to enable or disable this behavior. Or, it would be even more flexible if you can choose it on a per-block basis.

Comments

marcvangend’s picture

*bump*
Sorry, I know I don't have the 'right' to be answered, but I'd like to know if my request has been read, and I'm curious what you think. Is my question clear at all? Is this something you would consider adding, or do you think "do it yourself, you lazy bum!"?
Thanks.

TomChiverton’s picture

I'd like to see this feature too - with the admin menu, for instance, all the branches end up open, and restored to that, which makes the page very tall.

lilou’s picture

Assigned: cburschka » Unassigned

Insert in dhtml_menu.js in the top of Drupal.dhtmlMenu.switchMenu function :

// Close all menu :
	$(".menutitle").removeClass('expanded');
	$(".menutitle").addClass('collapsed');
	$(".submenu").css("display", "none");

It'll be great if this feature add to dhtml_menu (enable in the settings).

cburschka’s picture

Assigned: Unassigned » cburschka

I would like this too. I'll see if I can make some options available that control the behavior of the menus.

Options:

- When opening a menu:
   - Keep others expanded (default?)
   - Close other menus

- When closing a menu:
   - Keep sub-items open the next time it is opened (default?)
   - Close sub-items too

- When loading a page:
   - Open menus that were open on the previous page
   - Close all menus
   - Open the active menu path.
CosmicVoyager’s picture

subscribed

hydrian’s picture

Any possibility this feature be ported back to the D5.x branch?

cburschka’s picture

Unlikely, but faintly possible. I probably won't do it myself though...

ionuts71’s picture

So... I have the following taxonomy structure:

Vocabulary_1
    Term_11
       Term_111
          Story_1111
    Term_12
       Story_121

Vocabulary_2
    Term_21
       Story_211

and the same Primary links structure.
Links to vocabulary are provided by Vocabulary index module.
If I click on the first level (vocabulary) and on any story from second level, DHTML works OK.
If I click on the third level (Term_111) the menu is collapsing automatically (see http://www.hvac.ro/ right column. Vocabulary_1 = Electrice; Vocabulary_2 = Termice).
How can I use DHTML for multilevel menus?

marcvangend’s picture

@ ionuts71, #8:
It seems as if your question is not related to the feature request discussed in this issue-thread. Please start a topic in the forum or create a new support request issue. I recommend the forum, because your issue involves two different modules.

ionuts71’s picture

Thank you for your answer. My problem is related to this feature.
I insert the code from #3

// Close all menu :
$(".menutitle").removeClass('expanded');
$(".menutitle").addClass('collapsed');
$(".submenu").css("display", "none");

and now the menu is collapsing automatically but only the first level is working.

Now I disabled the second module (vocabulary index) and I have only DHTML menu with primary links, similarly structured like in my previous reply:

Vocabulary_1 [primary link to a page (node)]
    Term_11 [primary link to a vocabulary term (taxonomy term)]
        Story_111 [primary link to a story]
    Story_12 [primary link to a story (taxonomy term)]

Vocabulary_2 [primary link to a page (node)]
    Story_21 [primary link to a story (taxonomy term)]

If I click on Vocabulary_1 the menu is expanding showing the next level (Term_11 and Story_12).
If I click on Story_12, the menu works OK. If I click on Term_11, instead of showing the next level, Story_111, the menu is collapsing. So with the code from lilou (reply #3) partially work.
You can see how it work on http://www.hvac.ro/ on the right column DHTML Menu with lilou's modiffications and on the left column the regular menu block.

cburschka’s picture

Assigned: Unassigned » cburschka

I don't understand. Are you experiencing an actual bug with the real, unmodified Drupal 6 version of dhtml_menu, or are you experiencing a bug after manually adding code that isn't finished or tested properly?

Please either open a bug report or replace your modified files with the original ones, but do not post in the issue queue for this feature that has not even been written yet.

dmsmidt’s picture

I'd like to see this added too. It would be possible to hack the js of the module for me, but I'd like it better as an standard option in the module. *subscribing*

brmassa’s picture

Assigned: cburschka » brmassa
Status: Active » Fixed

Guys,

implemented. see http://drupal.org/node/151180#comment-792120

regards,

massa

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.