PDA

View Full Version : Multi level menu, that opens/closes on click



arbel
09-19-2007, 03:50 PM
Any one know of a menu similar to the suckerfish menu
http://www.htmldog.com/articles/suckerfish/dropdowns/
that opens/closes on a click instead of mouse hover?

Thanks

Idan

boogyman
09-19-2007, 03:56 PM
that would need to be a javascript activity, and cannot be done purely with css, which is the whole point of the suckerfish menu.

http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

arbel
09-19-2007, 04:01 PM
thanks. Yeh, the suckerfish is just an example I had of menu that works the same (from a user point of view).

The link you gave me is great, but's only one level, and I need second one...

I'll keep looking. Thanks for your help.

Idan

arbel
09-19-2007, 04:04 PM
also the anylink menu, isn't very customizable...

boogyman
09-19-2007, 05:57 PM
there is a whole section of menu's... look in there for options, the anylink was just the first one I noticed

arbel
09-19-2007, 06:28 PM
thanks, i'm trying to write me own..i'm a pretty novice....but i've run into a bit of trouble...

i'm using an event listener to detect clicks on certain <a> tags.


if(links[i].parentNode.parentNode.getAttribute("id") == "topLevel") {
Core.addEventListener(links[i], "click", clickMenu.topMenuListener);

this calls


topMenuListener: function(event){
clickMenu.topShowMenu(this);
Core.preventDefault(event);
},

which calls this:


topShowMenu: function(link){

if(clickMenu.activeMid == true) {
Core.removeClass(link, "openMid");
}
else {
//close all open mid and sub
//open mid
alert(link);
var menus = link.getElementsByTagName("ul"); //problem here
for(var i=0; i<menus.length; i++) {
if(menus[i].parentNode != this) {
alert(menus[i]);
Core.addClass(menus[i], "hide");
}
else
Core.addClass(menus[i], "showMid");
}


clickMenu.activeMid = true;
}
},

I'm trying to get all the element children of the <a> that was clicked...but I think i'm doing something wrong...be cause the link.getElementsByTag("ul"); doesn't quite work....when I alert(link) I get the path of the document...

arbel
09-20-2007, 11:31 AM
got it fixed and done:

http://www.dynamicdrive.com/forums/showthread.php?p=110302#post110302

enjoy!