Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:38
Menu with anchor links to close when clicked [SOLVED]
Poster: mfrie01
Dated: Thursday July 14 2005 - 22:19:41 BST
Everything's fine except when my link is on the page that's currently being displayed.
Go to http://www.cowlesgraphicdesign.com/vista/partners/partners.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:
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;")
}
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
Poster: slackbladder
Dated: Thursday July 14 2005 - 23:29:26 BST
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.
Poster: Ruth
Dated: Friday July 15 2005 - 4:55:39 BST
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:
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:
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
Poster: mfrie01
Dated: Friday July 15 2005 - 16:42:36 BST
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
Poster: Ruth
Dated: Friday July 15 2005 - 17:06:57 BST
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
Poster: mfrie01
Dated: Friday July 15 2005 - 17:09:49 BST
Ruth,
Thanks, I found the list of functions on the Milonic site. I wrote this and it works just fine now:
Code:
function goToPage(page) {
location.href = page;
closeAllMenus();
}
location.href = page;
closeAllMenus();
}
And then I changed my menu file to reflect the function call:
Code:
aI("text=Virtusa;url=javascript:goToPage('../partners/partners.html#virtusa');")
aI("text=batch.co.uk;url=javascript:goToPage('../partners/partners.html#batch');")
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