Menu with anchor links to close when clicked [SOLVED]

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
mfrie01
Advanced
Advanced
Posts: 10
Joined: Thu Jun 16, 2005 10:36 pm
Contact:

Menu with anchor links to close when clicked [SOLVED]

Post by mfrie01 »

Everything's fine except when my link is on the page that's currently being displayed.

Go to http://www.cowlesgraphicdesign.com/vist ... tners.html and drop down the "partners/partner program" submenu. Then click on any of the company names. The displayed page scrolls because the link is internal, but the menu doesn't close. This is consistent behavior wherever I have an internal link that's on the menu.

Here's the code for this submenu

Code: Select all

with(milonic=new menuname("partners_list")){
style=subMenuStyle;
aI("text=partner program overview;url=../partners/partners.html;pagematch=partners.html;")
aI("text=Virtusa;url=../partners/partners.html#virtusa;")
aI("text=batch.co.uk;url=../partners/partners.html#batch;")
aI("text=Impelsys;url=../partners/partners.html#impelsys;")
aI("text=Microsoft;url=../partners/partners.html#microsoft;")
aI("text=Cognos, Inc.;url=../partners/partners.html#cognos;")
aI("text=Expense World;url=../partners/partners.html#expense;")
aI("text=Flynet;url=../partners/partners.html#flynet;")
aI("text=HP;url=../partners/partners.html#hp;")
aI("text=Oracle;url=../partners/partners.html#oracle;")
aI("text=QAS;url=../partners/partners.html#qas;")
aI("text=Redwood;url=../partners/partners.html#redwood;")
aI("text=Servebase;url=../partners/partners.html#servebase;")
aI("text=Taxware;url=../partners/partners.html#taxware;")
aI("text=Unitech EDI Systems;url=../partners/partners.html#unitech;")
}
I want the menu to close when it's clicked. How?

Thanks,
Michael
Michael Friedlander
slackbladder
Super Advanced
Super Advanced
Posts: 72
Joined: Fri Jul 01, 2005 3:04 pm

Post by slackbladder »

FYI works fine with FireFox (MAC) and not at all with IE 5.2 (MAC). Not much help I know - but always good to get feedback across platforms.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

It is working as it should in IE5.5. This is the problem: even if you were able to code in closeonclick=1; in the aI string for those anchor items, the submenu hangs over the div containing the content, when you click, for example;

Code: Select all

aI("text=Virtusa;url=../partners/partners.html#virtusa;")
which takes you to that anchor name, the menu doesn't have time enough to close, even with that closeonclick, before the mouse is over some other item in that submenu. Since it is now over another item, the menu remains open. The only options I can think might work are:

1. some kind of function that will force the menu to close no matter what after a click

2. getting the anchor areas on the page below the bottom of the submenu in which their links appear. If you can do this, then the menu is off the screen so the mouse is off the submenu and it will close automatically.

3. try making that partners_link submenu

Code: Select all

orientation=horizontal; divides=3; (or maybe 5) 
What that does is make that submenu only 3 long and 5 columns wide, or 5 items long and 3 columns wide. Either of those makes the submenu open above that div with the anchors in it.

There may be better solutions, those are the only ones I could imagine with my level of knowledge.

Ruth
mfrie01
Advanced
Advanced
Posts: 10
Joined: Thu Jun 16, 2005 10:36 pm
Contact:

Post by mfrie01 »

Ruth,

Thank you for your response. I don't believe the menu depth encroaching onto the page is the issue as I've tried making it very short. It seems that because the page itself doesn't change there's no new menu to overwrite the old. Fact is, in normal operation, even if a menu didn't close you'd never know it because once the page changed you'd have a brand new closed menu.

You suggest a function to force the menu to close. It's easy to write the function to change the page, what do I add to get the menu to close? Can you refer this to someone who can help?

Thanks again,
Michael
Michael Friedlander
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi Michael,

I have my settings at 800x600 and it is working in that in all browsers with the 'shortened' submenu, when you posted back it occured to me that your settings might be higher. When I tried it at 1024x768 it won't work. The reason is because no matter what at that resolution or higher the mouse never moves off the menu because everything remains on the screen. That is the reason the submenu is not closing, because the mouse remains on it and that forces it to remain open.

Since this is not something I know about, I will post and see if anyone else can respond.

Ruth
mfrie01
Advanced
Advanced
Posts: 10
Joined: Thu Jun 16, 2005 10:36 pm
Contact:

Post by mfrie01 »

Ruth,

Thanks, I found the list of functions on the Milonic site. I wrote this and it works just fine now:

Code: Select all

function goToPage(page) {
	location.href = page;
	closeAllMenus();
}
And then I changed my menu file to reflect the function call:

Code: Select all

aI("text=Virtusa;url=javascript:goToPage('../partners/partners.html#virtusa');")
aI("text=batch.co.uk;url=javascript:goToPage('../partners/partners.html#batch');")
A little more work, but it now operates consistent with the other items.

Thanks for your help,
Michael
Michael Friedlander
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi Michael,

Thanks so much for posting the solution for others who might also have this issue. We really appreciate it.

Ruth
Post Reply