UBB.Dev
Posted By: Stilgar DD menu (minimizing code) - 12/10/2003 9:27 AM
Hey all,
I have a menu that is .js dropdown. I'd like to speed it up so that it load quicker and is less of a resource hog. Here is a sample:

Code
 function mmLoadMenus() {
if (window.mm_menu_0213144600_0) return;
window.mm_menu_0213144600_0 = new Menu("root",142,20,"Arial, Verdana, Helvetica, sans-serif",12,"#cccccc","#000000","#ff6600","#cccccc","center","middle",3,2,1000,0,0,true,true,true,0,false,false);
mm_menu_0213144600_0.addMenuItem("ADVOCACY","location='http://norcalcycling.com/advocacy/index.shtml'");
mm_menu_0213144600_0.fontWeight="bold";
mm_menu_0213144600_0.hideOnMouseOut=true;
mm_menu_0213144600_0.menuBorder=1;
mm_menu_0213144600_0.menuLiteBgColor='#ff9900';
mm_menu_0213144600_0.menuBorderBgColor='#000000';
mm_menu_0213144600_0.bgColor='#000000';
window.mm_menu_0213144344_1_1 = new Menu("LOCAL RIDING NEWS",142,20,"Arial, Verdana, Helvetica, sans-serif",12,"#cccccc","#000000","#ff6600","#cccccc","center","middle",3,2,1000,0,0,true,true,true,0,false,false);
mm_menu_0213144344_1_1.addMenuItem("NEWS ARCHIVE","location='http://norcalcycling.com/ridesandraces/archive.shtml'");
mm_menu_0213144344_1_1.fontWeight="bold";
mm_menu_0213144344_1_1.hideOnMouseOut=true;
mm_menu_0213144344_1_1.menuBorder=1;
mm_menu_0213144344_1_1.menuLiteBgColor='#ff9900';
mm_menu_0213144344_1_1.menuBorderBgColor='#000000';
mm_menu_0213144344_1_1.bgColor='#000000';
window.mm_menu_0213144344_1 = new Menu("root",142,20,"Arial, Verdana, Helvetica, sans-serif",12,"#cccccc","#000000","#ff6600","#cccccc","center","middle",3,2,1000,0,0,true,true,true,0,false,false);
mm_menu_0213144344_1.addMenuItem(mm_menu_0213144344_1_1,"location='http://norcalcycling.com/ridesandraces/index.shtml'");
mm_menu_0213144344_1.addMenuItem("EVENTS SCHEDULE","location='http://norcalcycling.com/ridesandraces/events.shtml'");
mm_menu_0213144344_1.addMenuItem("ON-ROAD RIDES","location='http://norcalcycling.com/ridesandraces/onroad.shtml'");
mm_menu_0213144344_1.addMenuItem("OFF-ROAD RIDES","location='http://norcalcycling.com/ridesandraces/offroad.shtml'");
mm_menu_0213144344_1.fontWeight="bold";
mm_menu_0213144344_1.hideOnMouseOut=true;
mm_menu_0213144344_1.childMenuIcon="http://norcalcycling.com/arrows.gif";
mm_menu_0213144344_1.menuBorder=1;
mm_menu_0213144344_1.menuLiteBgColor='#ff9900';
mm_menu_0213144344_1.menuBorderBgColor='#000000';
mm_menu_0213144344_1.bgColor='#000000';
as you can see, this code is repeated every time:
Code
      mm_menu_0213144344_1_1.fontWeight="bold";
mm_menu_0213144344_1_1.hideOnMouseOut=true;
mm_menu_0213144344_1_1.menuBorder=1;
mm_menu_0213144344_1_1.menuLiteBgColor='#ff9900';
mm_menu_0213144344_1_1.menuBorderBgColor='#000000';
mm_menu_0213144344_1_1.bgColor='#000000';
How can I have each link of the menu share one set of code? Some links also posess this as well:

Code
mm_menu_0213144344_1.childMenuIcon="http://norcalcycling.com/arrows.gif";  
Thanks for any and all help!
Posted By: AllenAyres Re: DD menu (minimizing code) - 12/10/2003 5:45 PM
have you tried using css for that?
Posted By: Stilgar Re: DD menu (minimizing code) - 12/10/2003 7:29 PM
I wouldn't know where to begin to use CSS for that. eek

laugh
Posted By: Stilgar Re: DD menu (minimizing code) - 12/17/2003 9:31 AM
smirk
© UBB.Developers