File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to overlap two or more <div>s? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to overlap two or more <div>s?" Watch "How to overlap two or more <div>s?" New topic

How to overlap two or more <div>s?

Ashish Gupta
Ranch Hand

Joined: Apr 27, 2003
Posts: 61
I am trying to build a multi level navigation bar with help of some javascript and jQuery. But am stuck with some display issue. Specifically the issue is that there are 2 menu bars place horizontally one above other, each enclosed in a <div> element. Initially 2 menubar will remain invisible. On clicking an item, say item1, in the top menu, associated menu bar below should get 'visible' while other menu bars will remain invisible or overlapped. Clicking on second item, say item2, should make the corresponding menu bar visible, overlapping the other one.

Issue I am facing that these 2 menu bars (in 2nd row) are placed stacked vertically instead of overlapping. if I use "style:display=none" then in my javascript I get some error when I try obj.getElementByID(<id>) and nothing seems to function in the javascript.

Here is the Javascript code:

Here is the code segment for top menu bar

PS: Read "href - " as "href =" above

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63839

Ashish Gupta wrote:PS: Read "href - " as "href =" above

Please post real code. Check "disable HTML" when posting.

And avoid red.

[Asking smart questions] [About Bear] [Books by Bear]
Ashish Gupta
Ranch Hand

Joined: Apr 27, 2003
Posts: 61
Here is the snippet of 'real' code. Not sure whether whole script is expected which might be handful.

Some suggestion will be helpful.
It is sorta covered in the JavaRanch Style Guide.
subject: How to overlap two or more <div>s?
It's not a secret anymore!