I have a problem to insert another new submenu to my navigation.
Here is my Javscript code:
// Main Nav Javascript Function *****************************************
var navTimer = "";
bop = new Object();
bop.targetDiv = "";
bop.hide = function(){
document.getElementById(bop.targetDiv).style.visibility = "hidden";
}
function openNav(myDiv){
if(bop.targetDiv != "") bop.hide();
bop.targetDiv = myDiv;
clearTimeout(navTimer);
document.getElementById(myDiv).style.visibility = "visible";
document.getElementById(myDiv).onmouseout = function(){
navTimer = setTimeout("bop.hide()", 100);
}
document.getElementById(myDiv).onmouseover = function(){
clearTimeout(navTimer);
}
}
function hideNav(myDiv){
bop.targetDiv = myDiv;
navTimer = setTimeout("bop.hide()", 150);
}
<!-- Display Sub Nav / Clear Sub Nav -->
function SubNav(myVar){
document.getElementById(myVar).style.visibility = "visible";
}
function clearNav(myVar){
document.getElementById(myVar).style.visibility = "hidden";
}
function shortPopUp( url, name, width, height, scrollbars ) {
var top = "0";
var left = "0";
if( scrollbars == null ) scrollbars = "0";
str = "";
str += "resizable=1,titlebar=1,menubar=1,";
str += "toolbar=0,location=0,directories=0,status=0,";
str += "scrollbars=1" + scrollbars + ",";
str += "width=" + width + ",";
str += "height=" + height + ",";
str += "top=" + top + ",";
str += "left=" + left;
window.open( url, name, str );
}
And here is my HTML code:
><div class="navItem" onMouseOver="SubNav('seat-twenty');" onMouseOut="clearNav('seat-twenty');"><a href="fps_twenty2.html" target="frame">Twenty2</a><div id='seat-twenty' class="dropDown" onMouseOver="SubNav('seat-twenty');" onMouseOut="clearNav('seat-twenty');">
<div class="navItem"><a href="fps_twenty2.html" target="frame">Twenty2 Overview</a></div>
<div class="navItem"><a href="fb_twenty2_black.html" target="frame">Twenty2</a></div>
<div class="navItem"><a href="fb_twenty2_red.html" target="frame">Twenty2-US</a></div>
<div class="navItem"><a href="fb_twenty2_red_black.html" target="frame">Twenty2-UP</a></div>
</div></div>
The page on the server can be found here.
The problem is under the seating tab of the navigation, when I tried to insert the new tag “Twenty2”, instead of open an extra submenu, the submenu still stay in the same dropdown menu…. and I check the code over and over, there’s no different between my error code and the correct code.
Here’s the code that works fine:
> <div class="navItem" onMouseOver="SubNav('seat-heavy');"
> onMouseOut="clearNav('seat-heavy');"><a href="fps_heavy_duty.html"
> target="frame">Heavy Duty</a><div id='seat-heavy' class="dropDown"
> onMouseOver="SubNav('seat-heavy');"
> onMouseOut="clearNav('seat-heavy');">
Does anybody know what’s wrong?
Your working menu items have an associated stylesheet rule with them, e.g.
but you don’t have one for
#seat-twenty, so when it pops up it instantly disappears because it thinks you scrolled out because it doesn’t have a margin-left set.All in all the menu works in a goofy way, I’d really recommend having something more generic so you don’t have to have a stylesheet entry for every item.
Relevant JS that inserts your stylesheet stylesheet