Cascade primary links implementation

hswong3i - June 15, 2008 - 07:15
Project:Multiflex-3
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:hswong3i
Status:closed
Description

I give a quick review about how Multiflex37 handle the cascade primary menu in D5, but soon found that shouldn't function in D6: D6 menu system come with a complete revamp, and most related functions (e.g. menu_navigation_links(), menu_secondary_links() and so on) are now based on current page. This revamp is very useful since will not load ALL menu item but only those are USEFUL during function call, but as a side effect we will not able to obtain ALL 2nd level menu item under primary menu at once.

As Multiflex-3's cascade primary menu system is a bit different from normal Drupal site style, it may be too complicated for handle it under Drupal menu admin system. I am thinking about if just simply GIVE UP the cascade primary menu implementation, but keep the theme as simple and elegant. Any suggestion or idea?

#1

hswong3i - June 19, 2008 - 09:50
Title:Cascade primary menu implementation» Cascade primary links implementation
Status:active» patch (code needs review)

Just give a revamp to primary links, and clone the original demo design to the theme. Some implementation is cut off, e.g. IE6 support. It is tested with FF2/3, Opera9.27/9.5, Safari3 and IE7. RTL support is not fully tested yet.

I also give a try to multiple layer of cascade menu implementation but failed. It is too complicated and rear case, the outlook is not too elegant and not easy to use, so just let it be.

Instruction is also documented in README.txt.

#2

hswong3i - June 19, 2008 - 09:52

set #272338 as duplicated.

#3

hswong3i - June 29, 2008 - 14:18

Set #275822 as duplicated. Some bugs are fixed, e.g. the cascade menu is run away when mouse move though the hover slowly.

#4

hswong3i - June 29, 2008 - 14:23

Primary links is now revamp with maximum 4 level of menus, which means you can have 3 layer of child items. It is very simple for extend its support layer (although I don't really think it is too useful...). E.g. now the other layers are implemented as:

/* Multi-level dropdowns */
#primary-links ul ul ul,
#primary-links ul li:hover ul ul,
#primary-links ul li:hover li:hover ul ul,
#primary-links ul li:hover li:hover li:hover ul ul {
  display: none;
}
#primary-links ul li:hover li:hover ul,
#primary-links ul li:hover li:hover li:hover ul,
#primary-links ul li:hover li:hover li:hover li:hover ul {
  display: block;
  top: 1em;
  left: 10em; /* LTR */
  right: auto; /* LTR */
  margin: 0 1.2em;
}
#primary-links ul li:hover li:hover a,
#primary-links ul li:hover li:hover li:hover a,
#primary-links ul li:hover li:hover li:hover li:hover a {
  background-color: #D2D2D2;
}
#primary-links ul li:hover li:hover li a,
#primary-links ul li:hover li:hover li:hover li a,
#primary-links ul li:hover li:hover li:hover li:hover li a {
  background-color: #EDEDED;
  border-top: solid 1px #AFAFAF;
  margin-top: -1px;
}

So if you hope to have one more layer, just put this into your custom.css:

#primary-links ul li:hover li:hover li:hover li:hover ul ul {
  display: none;
}
#primary-links ul li:hover li:hover li:hover li:hover li:hover ul {
  display: block;
  top: 1em;
  left: 10em; /* LTR */
  right: auto; /* LTR */
  margin: 0 1.2em;
}
#primary-links ul li:hover li:hover li:hover li:hover li:hover a {
  background-color: #D2D2D2;
}
#primary-links ul li:hover li:hover li:hover li:hover li:hover li a {
  background-color: #EDEDED;
  border-top: solid 1px #AFAFAF;
  margin-top: -1px;
}

As you can see, the key point is "how many li:hover are defined" :-)

#5

hswong3i - July 11, 2008 - 06:27
Status:patch (code needs review)» fixed

Zohar report that the cascade primary links is also function for RTL, so it's the time to set this issue as fixed :-)

#6

Anonymous (not verified) - July 31, 2008 - 04:46
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.