Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:

Advertise Here

CSS Library: Horizontal CSS Menus: Here

SuckerTree Horizontal Menu

Author: Dynamic Drive

SuckerTree Horizontal Menu is a CSS and DOM hybrid menu that's list based and supports multiple levels of sub menus. The trick to SuckerTree is a small adoptable piece of JavaScript that crawls the inner levels of a list menu and assigns the appropriate show/hide and positioning behavior to them. You can even have multiple SuckerTree menus on the same page.

See also: SuckerTree Vertical Menu.

Demo:

The two bullet images used:

The CSS:

The HTML:

Code Info

Rate this code:

Date Posted: 09/14/2006

Revision History: None

Usage Terms: Click here

Your Comments (314)

Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.

Comment Pages 14 of 32 pages « First  <  12 13 14 15 16 >  Last »

I am using it on Safari right now and it works great!
Posted by Fervor Singles on 04/09, 08:17 AM
i've the same problem !

"if you move folder 2.1 ABOVE sub item 2.1 the gap appears between the 2 items, so when you try to select the bottom 1 you move over the gap + the menu closes."

Does anybody finds THE solution to remove this gap?

Thanks !
Posted by Matthieu on 04/11, 10:18 AM
Not working to me. When i make my folder 1 and sub menu 1.1 its working fine. But when i make sub meenu 1.2 its not working i cant click on sub menu 1.2.
Posted by Sofa on 04/12, 08:24 AM
Works fine for me. Just use the hack by jchalos for the IE problem.
Posted by FireStorm on 04/20, 12:51 PM
It does not work in Firefow just shows the menu in tabular form, no drop downs etc. any ideas?
Posted by GaZ on 04/26, 09:35 AM
It worked fine for me in FireFox. You could try the "Son of Suckerfish" CSS dropdown menu as its easier to manage.
Posted by FireStorm on 04/26, 09:40 AM
Nice menu.

It's simple to use and stuff, but can be a bit tricky to use too though...

Great work you have done here at Dynamic Drive :)
Posted by Anders on 04/28, 05:47 AM
There's a small problem with this code that happens when a sub-menu has more than 1 sub-menus. For example:

<div class="suckertreemenu">
<ul id="treemenu1">
<li>Item 1</li>
<li>Item 2</li>
<li>Folder 1
<ul class="level0">
<li>Sub Item 1.1</li>
<li>Sub Item 1.2
<ul class="level1">
<li>Sub Item 1.2.1</li>
<li>Sub Item 1.2.2</li>
<li>Sub Item 1.2.3</li>
<li>Sub Item 1.2.4</li>
</ul>
</li>
<li>Sub Item 1.3</li>
<ul class="level1">
<li>Sub Item 1.3.1</li>
<li>Sub Item 1.3.2</li>
<li>Sub Item 1.3.3</li>
<li>Sub Item 1.3.4</li>
</ul>
<li>Sub Item 1.4</li>
</ul>
</li>
<li>Item 3</li>
<li>Folder 2
<ul class="level0">
<li>Sub Item 2.1</li>
<li>Folder 2.1
<ul class="level1">
<li>Sub Item 2.1.1</li>
<li>Sub Item 2.1.2</li>
<li>Sub Item 2.1.3</li>
<li>Sub Item 2.1.4</li>
</ul>
</li>
</ul>
</a>
</li>
<li>Item 4</li>
</ul>
<br style="clear: left;" >
</div>



It won't display the following sub-menus correctly. To fix this, use this javascript:



var menuids=["treemenu1"]; //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){
if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px"; //dynamically position first level submenus to be height of main menu item
ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon";
}
else{ //else if this is a sub level menu (ul)
var niveauMenu = ultags[t].className;
var positionAUtiliser = 0;
// We gotta check not only the previous ul, but the previous UL that's a level under it;
for (var z=t-1; z >= 0; z--)
{
if (ultags[z].className < niveauMenu)
{
positionAUtiliser = z;
break;
}
}
ultags[t].style.left=ultags[positionAUtiliser].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon";
}
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.visibility="visible";
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.visibility="hidden";
}
}
}
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false);
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal);


This should correct the problem. Just don't forget to add the class="levelX" in all the sub-menu ULS!!
Posted by Lukas on 04/30, 01:22 PM
ye, the links all in html code not in javascirpt!
i like it!
Posted by Endis on 04/30, 11:35 PM
i want this menu, but i cant put in the my page on top. not stop page head. help ?
Posted by rulman on 05/03, 02:29 PM

Comment Pages 14 of 32 pages « First  <  12 13 14 15 16 >  Last »

Commenting is not available in this weblog entry.
Copyright 2006-2011 Dynamic Drive Read our Usage Terms before using any of the CSS codes.