Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:18
Static link demo wich "onclick"
Poster: xMANIGHTx
Dated: Friday November 8 2002 - 9:23:51 GMT
I saw the "Static Link Demo". I need a similar effect but, while the demo works on mouseover/mouseout I need it to popup the menu onclick (this is easy) and to let it disappear when clicking OUT of the menu (a classic open-on-click-close-on-click-out style)
Can anyone help? Thanx in advance
Poster: Scott
Dated: Friday November 8 2002 - 15:40:41 GMT
Hi xMANIGHTx,
Ok you know how to make it work with an onclick command instead of an onmouseover..
To make it close just put a '1' in the appropriate line in the menu_array.js file.. the one that goes..
0, // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on or 0=off)
Remember that this is be set on every level of the menu.
Poster: xMANIGHTx
Dated: Friday November 8 2002 - 19:06:53 GMT
Well... listen to this. If I put:
<a href="javascript: popup('mymenu');">
It works fine (thanx Scott)
But if I try
<a href=# onclick="popup('mymenu');">
it doesn't work... i wonder why... by the way now it works great (first option)
Poster: kevin3442
Dated: Friday November 8 2002 - 20:40:10 GMT
Hi,
I'm not sure why you're using <a> tags and the popup() function at all, unless you're trying to open a menu from a standard <a> link elsewhere on the page. Normally, however, calls to popup() and looking for onclick events in the menu definitions are not necessary; the menus open and close by themselves, with the behaviors you set in the menu array.
When Scott wrote:
Quote:
Ok you know how to make it work with an onclick command instead of an onmouseover..
I assume he must've been referring to setting the 17th element of the menu array (I could be wrong). When the 17th element is left unset, the default behavior is to open the menu on mouse over. Setting the 17th element to 1 tells the menu defined in that array to open on click instead. To achieve the click-out effect, Scott mentioned the 13th element of the menu array ("// keep alive") . When the 13th element is left unset, the default behavior is to close the menu on mouse out. But if you set the 13th element to 1, then the menu, when opened, will remain open until you mouse over another menu or click off of the open menu. Both of these settings are made for each menu array (i.e., each time you use addmenu).
With these settings, you should be able to define your specific menu items as normal, without having to resort to onclick events and calls to popup().
Hope that helps,
Kevin
Poster: xMANIGHTx
Dated: Friday November 8 2002 - 21:54:57 GMT
This if useful if you want to open menus from standard static links.
Take a look at the STATIC LINK demo on milonic home page
Poster: kevin3442
Dated: Saturday November 9 2002 - 4:58:45 GMT
My bad. I guess that's what I meant by "...unless you're trying to open a menu from a standard <a> link elsewhere on the page." Which turns out to be exactly what you wanted... in other words, a static link, just as you said. Sorry. I misread and thought you were referring to the Static Images example on the home page itself, rather than the "Link Based - Static" example in the left side menu. Just goes to show that I should read more carefully... it'll save me from typing useless replies!
On another note, you already know that popup('menuname') will pop the menu at its predefined position. But did you know that if you use popup('menuname', 1) it'll pop the menu at the current MouseXY position? A useful little twist sometimes...
Kevin
Poster: xMANIGHTx
Dated: Saturday November 9 2002 - 9:42:41 GMT
Well... this is exactly what I need!!! Didn't know about the (..,1) function. I thought the mouse(x,y) where default. Many thanx!
Poster: xMANIGHTx
Dated: Monday November 18 2002 - 21:46:29 GMT
Hi Scott! I put the keepalive option to 1
1, // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on or 0=off)
But the menu only closes if I go on another menu. If I click everywhere on the page it doesn't close!
You can access it form here:
http://www.technosystemformazione.it/ev ... /menu2.htm
Any hint?
Poster: xMANIGHTx
Dated: Monday November 18 2002 - 21:48:36 GMT
Sorry forgot this:
To pop up the menu, you have to click on the ARROW DOWN near the "?" ICON in the first table head (FORMAZIONE - RICERCA)
Thanx again
Poster: Scott
Dated: Monday November 18 2002 - 22:35:39 GMT
Hi Mate..
Nice site btw..
I'm not sure what version of the menu you are using but I've just been having a play with version 3.5.05 and providing you have correctly set the keep alive tags for every menu (think it's the 12th comma along on the line e.g. ,,120,1,"",style1,,"left",effect,,,1,,,,,,,,,) the menu will shut when the mouse is clicked anywhere on the page.
I suggest you check the version of your mmenu.js file and download the latest, I think Andy has fixed a few bugs in this area recently.
Hope this helps
Scott