Adding D6 options to D5 version (close siblings option)

seutje - September 22, 2008 - 08:37
Project:DHTML Menu
Version:5.x-1.5
Component:Javascript code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

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

AttachmentSize
dhtml_menu.js3.9 KB

#1

phpsharma - October 8, 2008 - 10:34

This Worked fine for me in 5.1.7

#2

seutje - October 8, 2008 - 11:08

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

premanup - October 19, 2008 - 20:19

I've figured out no more jQuery slide effect for opening menu.

#4

seutje - October 20, 2008 - 08:21

I'm sry... what?

are u trying to say this modification makes the menu's not slide anymore?

#5

premanup - October 20, 2008 - 13:26

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

seutje - October 23, 2008 - 10:18

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

Quinti - May 8, 2009 - 09:03

ohs, thank u very much
That's exactly what I was trying to do,
very good,
thanks

#8

seutje - May 14, 2009 - 13:57
Assigned to:seutje» Anonymous

hmm, lost track of this and now it seems a lil silly to backport

my apologies

#9

demaker - May 26, 2009 - 08:43
Category:feature request» support request
Priority:minor» critical

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!

AttachmentSize
link.txt 54 bytes

#10

seutje - May 26, 2009 - 11:10
Priority:critical» normal

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

demaker - May 26, 2009 - 11:36

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

seutje - May 27, 2009 - 08:04

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

demaker - June 17, 2009 - 15:54

I switched to drupal 6. Thanks for your help.

#14

seutje - June 19, 2009 - 14:17

wise move I'd say ;)

#15

AjK - October 27, 2009 - 10:34

I had a D5 site that needed this functionality. Tried it out and did what it said on the tin. Thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.