For a website I’m working on the owners would like to have similar submenus as on this website. Can somebody please tell me how this is done? I’m sure it is Javascript or jQuery. I have been on Google for neary 4 hours now but only could find sollutions for one single div, where I need sub menus for at least 5 menu items. Any help from a forum guru would be highly appreciated.
The example is done with JavaScript - and the submenus don’t work at all for anybody with JS disabled. For my money, you’d be much better off with a pure CSS version.
Hi thank you a lot ralph for the links. They were very helpful. There is one thing which I can’t figure though!!! The sub menu’s background should go over the entire width of the screen, but the actual content from the menus should not be wider then 1000px. I have no idea how to do that? Any help would be highly appreciated
I found the suggestion of RyanReese to use dive very smart one but I am afraid that I don’t know how to use it in an appropriate way. this is what I have so far.
html, body {
width: 100%;
height: 100%;
}
body {
background: #AAA;
}
* {
margin: 0;
padding: 0;
}
ul, ol, li {
list-style: none;
}
#menu {
width:100%;
float:left;
background:#fff;
overflow:hidden;
position:relative;
z-index: 100;
}
#menu ul {
clear:left;
float:left;
position:relative;
left:50%;
text-align:center;
}
#menu ul li {
display:block;
float:left;
list-style:none;
position:relative;
right:50%;
}
#menu ul li a {
display:block;
margin:0 0 0 1px;
padding:3px 10px;
color:#000;
text-decoration:none;
line-height:1.3em;
}
#menu ul li a:hover {
color:#ff0000;
}
#menu ul li.accommodation,
#menu ul li.discover,
#menu ul li.prices,
#menu ul li.contact {
width: 0;
height: 0;
position:absolute;
left: -9999px;
top: -9999px;
}
#menu ul li:hover .accommodation,
#menu ul li:hover .discover,
#menu ul li:hover .prices,
#menu ul li:hover .contact {
width: 100%;
height: 60px;
top: 60px;
background: #CCC
}
It is obvious that this is wrong because the 100% I use for the submenus is related to the parent li, but I have realy no idea what other approach to take.
I just noticed in Paul’s example is that he is using #nav li ul li and #nav li ul ul and that is confusing me somehow (I see the logic but don’t know how to convert it to my situation). I thought using a div as RyanReese suggested would be the most appropriate way for me since all 4 submenus will have a different structure