Below is one solution around this problem, which lets you specify a "max height" setting for a specific drop down menu you know will be very long. The drop down menu in this case will have scrollbars, and content that flows beyond the max height (ie: 500px) will be reached by scrolling within the drop down menu.
To implement this change, firstly, replace the function dropdownmenu() within the script with the modified version below:
Code:
function dropdownmenu(obj, e, menucontents, menuwidth, optmaxheight){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
//////// BEGIN MAX HEIGHT CODE ADDITION /////////////
if (typeof optmaxheight!="undefined"){
dropmenuobj.style.height=optmaxheight
dropmenuobj.style.overflow="scroll"
}
else{
dropmenuobj.style.height=""
dropmenuobj.style.overflow="auto"
}
/////// END MAX HEIGHT CODE ADDITION ///////////////
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}
Then, in the HTML for the menu link you know has a very long drop down menu, do the following:
Code:
<a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px', '500px')" onMouseout="delayhidemenu()">Web Design</a>
The "500px" at the end is the added parameter you enter to specify this drop down menu's max height. The result is the drop down menu will be 500px tall and with scrollbars. Note that for all other menu links that don't have long drop down menus, this parameter shouldn't even be specified.
Bookmarks