YADM is an accessible DHTML dropdown/flyout/explorer solution with complete separation of CSS and JavaScript. YADM was developed to help you create navigations that make sense, not to create whizz-bang navigations that are there for the sake of being flashy.
YADM-Yet Another Dynamic Menu - How it Works (Page 3 of 4 )
YADM uses DOM to enhance a nested list by adding and removing different CSS classes to and from it. I will not get into details of the JavaScript here, as the script itself has loads of comments in it. What it does is the following:
Check if the browser is capable of using DOM
Check if the element with the ID nav is available
Loop through all the LIs inside this UL
Check if either the LI or any of the LIs inside the nested UL contain the class current.
If that is not the case, apply the class isParent to the LI and hiddenChild to the nested UL.
If that is the case, apply the class isActive to the LI and shownChild to the nested UL.
If there is no current in the LI, apply a function that swaps the classes (isParent becomes isActive and hiddenChild shownChild) and renders the link inside the LI useless (to avoid clicking and loading the page instead of showing the menu)
If there is no class called nohover in the main UL, apply the class onmouseover and onclick and revert to the original state onmouseout.