PDA

Click to See Complete Forum and Search --> : horizontal navigation menus


Emmanize
07-06-2007, 01:59 PM
I am struggling with a horizontal navigation menu. I have set it up however i am struggling to get the sub menus to drop down when you hover over it. Can anyone help me?

I never normally use menus so this is a little new.

HTML

<div class="suckertreemenu">
<ul id="treemenu1">
<li><a href="#" style="border-left: 1px solid black">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Folder 1</a>
<ul>
<li><a href="#">Sub Item 1.1</a></li>
<li><a href="#">Sub Item 1.2</a></li>
<li><a href="#">Sub Item 1.3</a></li>
<li><a href="#">Sub Item 1.4</a></li>
</ul>
</li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Folder 2</a>
<ul>
<li><a href="#">Sub Item 2.1</a></li>
<li><a href="#">Folder 2.1</a>
<ul>
<li><a href="#">Sub Item 2.1.1</a></li>
<li><a href="#">Sub Item 2.1.2</a></li>
<li><a href="#">Sub Item 2.1.3</a></li>
<li><a href="#">Sub Item 2.1.4</a></li>
</ul>
</li>
</ul>
</a>
</li>
<li><a href="#">Item 4</a></li>
</ul>
<br style="clear: left;" />
</div>

CSS

.suckertreemenu ul{
margin: 0;
padding: 0;
list-style-type: none;
margin-top: 20px;
}
/*Top level list items*/
.suckertreemenu ul li{
position: relative;
display: inline;
float: left;
background-color: #FFCB05; /*overall menu background color*/
}
/*Top level menu link items style*/
.suckertreemenu ul li a{
display: block;
width: 90px; /*Width of top level menu link items*/
padding: 1px 8px;
border: 1px solid black;
border-left-width: 0;
text-decoration: none;
color: #000;
font: normal 11px verdana,arial,helvetica,sans-serif;
}

/*1st sub level menu*/
.suckertreemenu ul li ul{
left: 0;
position: absolute;
top: 1em; /* no need to change, as true value set by script */
display: block;
visibility: hidden;
}
/*Sub level menu list items (undo style from Top level List Items)*/
.suckertreemenu ul li ul li{
display: list-item;
float: none;
height: 30px;
}
/*All subsequent sub menu levels offset after 1st level sub menu */
.suckertreemenu ul li ul li ul{
left: 159px; /* no need to change, as true value set by script */
top: 0;
}
/* Sub level menu links style */
.suckertreemenu ul li ul li a{
display: block;
width: 160px; /*width of sub menu levels*/
color: #000;
text-decoration: none;
padding: 1px 5px;
border: 1px solid #ccc;
}
.suckertreemenu ul li a:hover{
background-color: #F05323;
color: white;
}
/*Background image for top level menu list links */
.suckertreemenu .mainfoldericon{
background: #F05323 url(...images/arrow-down.gif) no-repeat center right;
}
/*Background image for subsequent level menu list links */
.suckertreemenu .subfoldericon{
background: #F3F3F3 url(media/arrow-right.gif) no-repeat center right;
}
* html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
padding-top: 1em;
}

/* Holly Hack for IE \*/
* html .suckertreemenu ul li {
float: left; height: 1%;
}
* html .suckertreemenu ul li a {
height: 1%;
}
/* End */

Two-Toe Tom
07-06-2007, 02:04 PM
I found this googling "drop down menu javascript": http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm

Emmanize
07-06-2007, 02:17 PM
Legend!
Ill have a bash at it now.

katgal
07-07-2007, 01:42 AM
I recently (just this morning) set one up on a site I'm working on: www.scrippscosmeticsurgery.com (http://www.scrippscosmeticsurgery.com).

Got the code at:
http://www.cssplay.co.uk/menus/drop_examples.html