CSS-JS Hybrid Multi-level Menu

By Manu

Hi everyone,

I have been working on my personal implementation of a CSS menu to brush up my CSS. You can download the source from here. I must declare here that I modified and used the javascript code from some other implementation. I cant recall from where but I will find out and update this post.

I wanted the menu to be simple to implement and also standards compliant. I wanted the HTML to be no more than a simple nested UL, and so it is. So, I set off to make the menu.

It has always been a tough experience with IE, and yet again I found myself running for hacks to make IE work. My implementation requires a mouseover event on LI, so “li:hover” should work, RIGHT?…… WRONG. In IE “:hover” pseudo class is only applicable to anchor tags. So I had to include a conditional javascript block to attach event handlers to the mouseover and mouseout events of the LI element for IE.

For other browsers I have implemented similar behavior using CSS using the famous “html > body” hack.

The menu is working just fine, except for one thing. The borders of the parent menu are showing through the submenu, in spite of the “z-index” setting. Just look at the snapshots below.

IE

Overlapping borders in IE

Firefox and other browsers

Working fine in Firefox

Still figuring out how to solve it. I would love to receive your feedback.

[Update] The IE bug is solved. Download the latest version from here. Thanx to Lalit.

6 Responses to “CSS-JS Hybrid Multi-level Menu”

  1. Dennison Uy - Graphic Designer Says:

    Maybe you can show your code? Kind of hard to guess what’s going on by just looking at screenshots.

  2. Manu Says:

    I have included a link for the source code in the 3rd line. Anyways, here is the link

    http://rapidshare.com/files/46716617/menu.zip

    Unfortunately I cannot properly include the code in the post.

  3. Lalit Tankala Says:

    Hellos…..

  4. Manu Says:

    Hi Lalit, how r u?….. got any suggestions on this?….. I am stuck for like 3 days on this

  5. Lalit Tankala Says:

    Hello Sir. I have solved it. I tried to paste it here but i think that didn’t get. I will send you across sometime. You can refer it here in this link: —–

    http://www.dynamicdrive.com/forums/showthread.php?t=19925&page=2&highlight=SuckerTree

    That would solve the problem you are having.

  6. Manu Says:

    Thanx Lalit, I have updated the code in the post. I will be working on enhancing it now.

Leave a Reply