View Full Version : menu with sub menu under it

08-11-2007, 07:09 PM
i have made a menu based on "Modern Bricks Menu" from the dd css library

the problem is i can't get the javascript part of what i want to work.
assume we have this html:

<div id="menu">
<div id="rootmenu">
<li id="home"><a href="#">home</a></li>
<li id="test"><a href="#">test</a></li>

<div class="submenu">
<div class="sub" id="home-sub">
<a href="#">1</a> |
<a href="#">2</a> |
<a href="#">3</a> |
<div class="sub" id="test-sub">
<a href="#">1</a> |
<a href="#">2</a> |
<a href="#">3</a> |

i want to do the folowing:
on mousover-ing a <li>(or the link inside it)

-the bar under the menu must
change in the bar representing the submenu of that item
(when i mouseover "home" "home-sub" changes from "hidden" to "block")
-the color of the <li> must change in the color for that item
-the color of the previsously selected <li> must return to black
-the previsously open sub-div must be returned to "hidden"

now i heve the following code (some parts are dutch):

function uitklappen(welke, color)
document.getElementById("home").style.background = "black";
document.getElementById("videoportal").style.background = "black";
document.getElementById("gallery").style.background = "black";
document.getElementById("members").style.background = "black";
document.getElementById("klap_home").style.display = "none";
document.getElementById("klap_videoportal").style.display = "none";
document.getElementById("klap_gallery").style.display = "none";
document.getElementById("klap_members").style.display = "none";
var deze = document.getElementById("klap_"+welke);
var rootmen = document.getElementById(welke);
welke.style.background = color;


where the klap_ are the ids of the "underbar"

it works but the problem is that every time the function is called it must first reset all the elements background or display.

so my (simple) question is,
is there a simple way to scan all the li/div -s and change their states inside the menu div?

or must i try a different approch?


08-21-2007, 10:06 PM
Ah yes, the good 'ol modern brick menu. Fantastic menu, but i also desperately need a sub menus drop down for it. I don;t know coding that well to be able to help you sorry.

thanks anyway for it, Ryan.