Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Why in ver. 3.2 this module ignore default expanded menu item? In ver. 2.2 it worked well.
I would like to when open the site, some items have already been expanded.
Comment | File | Size | Author |
---|---|---|---|
#15 | dhtml_menu.module.patch | 972 bytes | berenddeboer |
Comments
Comment #1
cburschkaThis may be a bug. After updating to 6.x-3.3, could you please check the following:
1.) Disable the "Close siblings" effect in DHTML Menu settings (if it is enabled)
2.) Open a few menus
3.) Click a link to another page
4.) Check whether the menus you opened in 2.) are still open.
If this works, and you mean the "always expanded" menus set in the menu settings are not automatically open, that isn't possible right now, but may be added in a future version.
Comment #2
HallSL CreditAttribution: HallSL commentedThe help text on the click box for expanded reads "If selected and this menu item has children, the menu will always appear expanded."
And that's the functionality I thought I'd seen in the past and need for my current site. +1 on the feature request. In the mean time, the help text should be changed to something like "If selected, this menu will stay expanded after the user expands it."
Comment #3
m4t CreditAttribution: m4t commentedI'm interesting too!
I'd like to have expansion menu as a default behaviour...
Comment #4
MrVee CreditAttribution: MrVee commentedAny update on this? I would like this feature too work as well
Comment #5
thtas CreditAttribution: thtas commentedI just hacked together this bit of code to open up one of my top level menu items by default when the page is loaded.
It's not ideal, but it might help somebody else who needs this functionality
Added to the header section of page.tpl.php
Comment #6
cburschkaThis would be a nice feature to have, but seeing as the menu tree is readily expandable by hand without requiring extra page-loads, having certain menus pre-expanded is not essential; so it's postponed for a while.
This feature could cause problems combined with the "leave only one item open at a time" feature, when multiple items are opened, but the D7 version already sanitizes contradictory options, so D6 could do so as well.
All in all, what is necessary here is a call to
variable_get('menu_expanded')
in the dhtml_menu_theme_menu_item function (right next to the $_COOKIE part, I'd say).Comment #7
cburschkaLooks fairly easy. I'll patch just as soon as the rest of the D7 changes are done.
May be backported to D6 if it turns out to be as simple as it seems.
Comment #8
heyqule CreditAttribution: heyqule commentedthanks thtas... here is my version... The listed items are expanded by default. Then it will follow dhtml_menu cookie..
Comment #9
BoobaaIt seems to be quite easy to solve: all we have to to in hook_init() (?) is pushing down the always-expanded mlid's to jQuery, and add a slightly modified version of #8's JS, which iterates through Drupal.settings.whatever, and not a burn-in constant array. If we want to be efficient, then we push down only the displayed always-expanded mlid's, and not all of them.
Should I prepare a patch (for d6), which does this?
Comment #10
AdrianB CreditAttribution: AdrianB commented+1 for this feature simply because the Expanded attribute clearly says so ("If selected and this menu item has children, the menu will always appear expanded.") and DHTML Menu should honor that instead of creating a confusing user experience.
Comment #11
cburschkaThis has been fixed in 6.x-4.x and 7.x-1.x.
Comment #13
lduerig CreditAttribution: lduerig commentedI upgraded to version 4 for drupal 6, and it doesn't seem very fixed to me...
Comment #14
jaarong CreditAttribution: jaarong commentedI'm needing a fix on this also.
Comment #15
berenddeboer CreditAttribution: berenddeboer commentedTested this with 3.5 and indeed expanded is not honoured. This is not about how easy it is to open the menu, it is that certain customers want menus always to be displayed in a certain way.
The following simple patch makes sure that expanded is always honoured. I.e. when you say a menu is expanded, on every page it will be expanded, unless you have closed it manually.
Comment #16
Dirk CreditAttribution: Dirk commentedSeems to work for me on 3.5, thanks for posting this.
Comment #17
liminu CreditAttribution: liminu commentedI try this, but not function.
When I select in the menu expanded the menu will be expanded but when I uncheck the checkbox, clear the cache, but the menu will expanded.
edit: the first 15 menu work correctly, only the last 3 in the display block has this problem
edit2: the problem was with the taxonomy, if the menu will be create with the module taxonomy menu it function correctly.
Comment #18
maxilein CreditAttribution: maxilein commentedIt does definitely not work with a book toc. Although the nodes are set to expanded the book toc (on which I am using dhtml menu) always opens collapsed.
Ideally I'd like to start with the top-level collapsed; opening a top-level items shows all sub-levels expanded.
Comment #19
pgillis CreditAttribution: pgillis commented6.x-4.x seems to work for me. Any idea of when the 4.x line will be released?
Comment #20
ionmedia CreditAttribution: ionmedia commentedit is not working at all
first menu expanded in menu item settings and second not
Comment #21
dianacastillo CreditAttribution: dianacastillo commentedI am trying to do this with javascript since it doesnt work for me with jquery , this is the script, it changes the class to expanded but doesnt expand it. any help would be apreciated:
Comment #22
dianacastillo CreditAttribution: dianacastillo commentedI get $ is not a function .
how would you rewrite it for drupal 7 ?
http://technotes.tostaky.biz/2012/05/about-jquery-usage-in-drupal.html
Comment #23
dianacastillo CreditAttribution: dianacastillo commentedI get TypeError: Drupal.dhtmlMenu.cookieGet is not a function
Comment #24
dianacastillo CreditAttribution: dianacastillo commentedIve got it working like this
Comment #25
atiba CreditAttribution: atiba commentedAny updates on this? "Show as expanded" still doesn't work for me in the latest dev version (7.x-1.x-dev).
Comment #26
gittosj CreditAttribution: gittosj commentedMy solution was to test if the front page is being loaded and then fake a click on the first menu link. Seemed simpler and doesn't require hard coding of #ids etc:
Seems to work as a workaround