Auto open submenu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
PaulS
Beginner
Beginner
Posts: 1
Joined: Thu Oct 30, 2003 1:24 pm

Auto open submenu

Post by PaulS »

Hi.

Is it possible to tell a submenu to auto open, so it would appear that when you are clicking between menus that it has a memory?

eg.

I rollover menu item 1 and the submenu appears i click on the link, that page has the DHTML menu it it but the js auto opens the submenu.

I have tried using keepalive but this is no good.

Thanks
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

We really should consider a nice little section for code snippets for things such as this...definetly gotta get around to that.. :lol: .

See this ... viewtopic.php?t=2937
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Paul, Dave,

Dave (Hergio)... I assume you mean to call mm_showMenu() in the body's onload event for the new page. It had also occurred to me to suggest the mm_showMenu() function, or even the built-in popup(). But then it occurred to me that those wouldn't work if the submenu is defined the way most are... without a location specified. It's been my experience that popup() with just a menuName won't work unless the system can derive a location: either the menu's location was specified in the menu definition (not typical for submenus), it was previously opened on the same page, or its position has been set programtically.

So, once the submenu opens on the initial page, it has a location. But when a new page loads (from clicking a link on the submenu), the menus are built anew and that will reset the submenu back to its locationless state. So the popup() function on the second page won't be able to re-show the menu unless it already has a position. Of course, you could write a function to set the submenu's location before calling popup()... maybe something like a mm_popupAt(menuName, top, left) function, where you pass coordinates. But to make it flexible, and have it accurately reflect the submenu's location on the previous page, the loaction from the original page would have to be passed to the next page, parsed, then fed to the function that re-opens the menu in the same location. At least that's my take... maybe I'm full of crap, but that's my impression of how the stuff works after playing around with different ways to open menus.

I think Paul's goal is do-able, but a little hairy if you're not familiar with js. I was thinking of giving it a try -- I wanted to mess with getting and setting positions anyway. But I'm a little strapped for time tonight and tomorrow. I could maybe give it a shot next week. Anyone else wnat to jump in?

Kevin
Post Reply