Hi all,
I have a suckerfish dropdown menu that uses images for the menu color (thanks to Centauri for getting it working for me, [URL=”http://www.webdeveloper.com/forum/showthread.php?t=172855″]previous thread
However I had this problem before and I still have it now. On hover, I want to change the color, specifically, I want to change the images that I use for the menu to a different image. The problem is that the new image displays in the background, behind the original menu image instead of replacing it or appearing in front (does the same thing if I just use a regular background color too).
Can anyone help me to figure out why this is happening? I included the two images that are used for the menu (button-left and button-right), and the two images that I am trying to use for the hover (buttonOver-left and buttonOver-right). The css page, javascript page, and html page are below.
Thanks again.
[B]CSS
[CODE]#vertnav{
padding:0;
margin:0;
list-style: none;
width: 12em;
}
#vertnav li {
margin:0;
position: relative;
width: 11.5em;
background-color:#CCC;
border:solid 1px #CCC;
border-bottom:none;
padding: 0.25em;
}
#vertnav li:last-child{border-bottom:1px solid #CCC;}
#vertnav a {
text-decoration:none;
display:block;
height:1em;
line-height: 1em;
padding: 0.1em;
}
#vertnav .toplev {
background-image: url(images/button-left.jpg);
background-repeat: no-repeat;
background-position: left center;
}
#vertnav .toplev a {
background-image: url(images/button-right.jpg);
background-repeat: no-repeat;
background-position: right center;
text-align: center;
}
#vertnav li:hover, #vertnav li.over {
/*background-color:rgb(255, 255, 204);*/
background-image: url(images/buttonOver-left.jpg);
background-repeat: no-repeat;
background-position: left center;
}
#vertnav ul {
list-style: none;
width:12em;
position:absolute;
left: -999em;
top: 0px;
margin: 0;
padding: 0;
}
#vertnav li:hover ul ul, #vertnav li:hover ul ul ul,
#vertnav li:hover ul ul ul ul, #vertnav li:hover ul ul ul ul ul,
#vertnav li.over ul ul, #vertnav li.over ul ul ul,
#vertnav li.over ul ul ul ul, #vertnav li.ver ul ul ul ul ul {
left: -999em;
}
#vertnav li:hover ul, #vertnav ul li:hover ul, #vertnav ul ul li:hover ul,
#vertnav li.over ul, #vertnav ul li.over ul, #vertnav ul ul li.over ul {
left: 12em;
}
* html #vertnav li {
float: left;
}
[B]Javascript
[CODE]sfHover = function() {
var sfEls = document.getElementById(“vertnav”).getElementsByTagName(“LI”);
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=” over”;
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(” over\b”), “”);
}
}
}
if (window.attachEvent) window.attachEvent(“onload”, sfHover);
[B]HTML
[CODE]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<title>Untitled Document</title>
<script type=”text/javascript” src=”sfhover.js”></script>
<link rel=”stylesheet” type=”text/css” href=”multimenuvert.css”>
</head>
<body>
<ul id=”vertnav”>
<li><div class=”toplev”><a href=”#” >first Level menu</a></div>
<ul>
<li><a href=”#” >second Level menu</a></li>
<li><a href=”#” >second Level menu</a>
<ul>
<li><a href=”#” >third Level menu</a></li>
</ul>
</li>
</ul>
</li>
<li><div class=”toplev”><a href=”#” >fourth Level menu</a></div>
<ul>
<li><a href=”#” >fifth Level menu</a></li>
<li><a href=”#” >fifth Level menu</a>
<ul>
<li><a href=”#” >sixth Level menu</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</body>
</html>
[upl-file uuid=66495b20-c68d-461c-9405-8a4260ebeed6 size=2kB]buttonOver-left.jpg
[upl-file uuid=203f4df9-7fcd-49eb-b5c6-c49357f2f4f6 size=789B]buttonOver-right.jpg
[upl-file uuid=c6daeb27-4316-4249-bc9a-899468a773ec size=1kB]button-left.jpg
[upl-file uuid=fd8ee3ac-c9ef-40cd-a569-0da919cf0955 size=785B]button-right.jpg