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:16
onfunction for entire submenu?
Poster: blah45
Dated: Thursday August 5 2004 - 18:00:03 BST
Is there a way to apply the same mouseover/mouseout function for an entire submenu, rather than calling it in each submenu item?
Example at: http://www.dreamindigital.com/oak/
I have it working so that for each section of the menu, a different rollover image fades in and is displayed somewhere else on the page. To do this, I use the on/offfunction in the main menu like this:
Code:
aI("text=alumni;showmenu=Alumni;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
But, when you go to the submenu of "Alumni" (and the others too) it needs to keep displaying that same rollover image so I also have to declare the on/offfunctions for all the "Alumni" submenu items like this (and they are all the same for that submenu):
Code:
with(milonic=new menuname("Alumni")){
style=menuStyle;
aI("text=link 1;url=/link1;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 2;url=/link2;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 3;url=/link3;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 4;url=/link4;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
}
style=menuStyle;
aI("text=link 1;url=/link1;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 2;url=/link2;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 3;url=/link3;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
aI("text=link 4;url=/link4;onfunction=JSFX.fadeIn('side','side3');offfunction=JSFX.fadeOut('side');");
}
However, this causes the image to flash each time you go to another menu submenu item. I've made it less noticable by drastically reducing the fade out time but that makes it slow and annoying. A better fix would be to just declare the on/offfunction once for the entire submenu! Is there a way to do this?
Thanks.
Poster: John
Dated: Thursday August 5 2004 - 18:43:06 BST
onfunction and offfunction are also style properties. Declare them there.
See http://www.milonic.com/forum/viewtopic.php?t=2981.