Adding D6 options to D5 version (close siblings option)
| Project: | DHTML Menu |
| Version: | 5.x-1.5 |
| Component: | Javascript code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Hi there, I've added the D6 functionality of closing the siblings of a menu upon opening it.
I've not yet set is as an option in the DHTML menu settings page, but I'm working on that so I can finally roll out my first contribution \o/
here's the temporary version of the js to have direct siblings close upon opening a menu, which in other words simple makes sure that only 1 menu is open at a time
it will not close child menus and it will not close siblings at the same level in different menus
working on a proper patch, but considering our active project does not need this functionality anymore, it might be a while until I can find the time to finish this properly
I would however appreciate testing and feedback on this functionality
| Attachment | Size |
|---|---|
| dhtml_menu.js | 3.9 KB |

#1
This Worked fine for me in 5.1.7
#2
yeh, but I wanna work on implementing them as options and to add an option to select all the siblings (not just the ones in the same menu)
#3
I've figured out no more jQuery slide effect for opening menu.
#4
I'm sry... what?
are u trying to say this modification makes the menu's not slide anymore?
#5
yes, I mean this modification makes the menu's not slide any more when it's opening. Closing menu works properly as original script provide.
#6
that's odd, I didn't even change anything about this line
$(submenu).animate({height: 'show', opacity: 'show'}, '500');just added handling for the siblings
does the original script make menu's slide open properly? although I don't rly see how anything could interfere
#7
ohs, thank u very much
That's exactly what I was trying to do,
very good,
thanks
#8
hmm, lost track of this and now it seems a lil silly to backport
my apologies
#9
Ah.... I'm trying to use the dhtml_menu.js which makes sure that only 1 menu is open at a time. It's not working in my situation.
Could you please have a look 'Seutje' at this link. (see attachment) Hopefully you can help me with this. Thanks in advance!
#10
the link you provided uses http://78.157.195.41/~rubenbelli/rubenbellinkx_drupal/modules/dhtml_menu... which doesn't close direct siblings like the one at the top of this issue
#11
Thanks for your reply.
Hmm sorry, I replaced it over and over and lost track I think.
What I just did....
I copied the code from above but still it doesn't close the direct siblings. Is it the structure of my menu? Hope to hear from you.
#12
hmm, looks like every tree is a separate menu, and wrapped in it's own ul:
<ul class="menu dhtml_menu menu-root">
<li id="menu-sub106" class="menutitle expanded"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/" style="display: block; z-index: 2;">film/video</a>
<div style="display: block;" id="sub106" class="submenu sub-expanded">
<ul class="menu dhtml_menu">
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">stream</a></li>
<li class="leaf"><a href="/~rubenbelli/rubenbellinkx_drupal/?q=node/8">mattrass, taps, fire</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the table turning</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the musical chair</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">troissoeur</a></li>
</ul>
</div>
</li>
</ul>
<ul class="menu dhtml_menu menu-root">
<li id="menu-sub91" class="menutitle expanded"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/" style="display: block; z-index: 2;">installations</a>
<div id="sub91" class="submenu sub-expanded" style="display: block;">
<ul class="menu dhtml_menu">
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">houseplant</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">elephant's ear</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">light - sensitive material</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the five sinks</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">rat experiment</a></li>
</ul>
</div>
</li>
</ul>
instead of:
<ul class="menu dhtml_menu menu-root"><li id="menu-sub106" class="menutitle expanded"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/" style="display: block; z-index: 2;">film/video</a>
<div style="display: block;" id="sub106" class="submenu sub-expanded">
<ul class="menu dhtml_menu">
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">stream</a></li>
<li class="leaf"><a href="/~rubenbelli/rubenbellinkx_drupal/?q=node/8">mattrass, taps, fire</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the table turning</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the musical chair</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">troissoeur</a></li>
</ul>
</div>
</li>
<li id="menu-sub91" class="menutitle expanded"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/" style="display: block; z-index: 2;">installations</a>
<div id="sub91" class="submenu sub-expanded" style="display: block;">
<ul class="menu dhtml_menu">
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">houseplant</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">elephant's ear</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">light - sensitive material</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">the five sinks</a></li>
<li class="leaf"><a class="active" href="/~rubenbelli/rubenbellinkx_drupal/">rat experiment</a></li>
</ul>
</div>
</li>
</ul>
which is probably the reason it considers it to be 2 separate menu's
#13
I switched to drupal 6. Thanks for your help.
#14
wise move I'd say ;)
#15
I had a D5 site that needed this functionality. Tried it out and did what it said on the tin. Thanks.