Menu Bugs: Missing px declaration in menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
luegner
Advanced
Advanced
Posts: 21
Joined: Fri Dec 12, 2003 6:49 pm

Menu Bugs: Missing px declaration in menu

Post by luegner »

Seamonkey 1.0b and Firefox 1.5 complain about missing px declarations in the latest version (5.738) of the menu.

Here are the offending lines:

_fsize=(_I[12]?";font-Size:"+_I[12]:Z$);

->

_fsize=(_I[12]?";font-Size:"+_I[12]+"px":Z$);

in $z function:

$S.width=$T

->

$S.width=$T+"px";
luegner
Advanced
Advanced
Posts: 21
Joined: Fri Dec 12, 2003 6:49 pm

Post by luegner »

Never mind. I'm retarded. I forgot to put in px after setting the values myself. Perhaps a possible enhancement would be to get the substr of the last two characters of the value and if they're not "px" and the value is not empty, then append px to the value.
luegner
Advanced
Advanced
Posts: 21
Joined: Fri Dec 12, 2003 6:49 pm

Standard for declaring pixel values

Post by luegner »

This menu is a bit quirky when declaring px values. In some places, it's allowed and in those cases required and in other places, if you declare it, it breaks what it's supposed to be setting. For all values that can have px appended to them, the menu should intelligently check to see if the px value exists first and if it doesn't, then it should append it.

An example of this quirk would be that you have to set "px" after the number value for menuwidth, it will throw an error, but if you set it after left or top, it breaks the absolute positioning ability.
luegner
Advanced
Advanced
Posts: 21
Joined: Fri Dec 12, 2003 6:49 pm

Post by luegner »

Actually it looks like $S.width=$T really should be changed. It looks like this value gets set when no menuwidth is set. $T doesn't already have "px" appended to it, so that really is a bug.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Have you got a copy of your menu_data.js that Firefox complains about.

All px values should be inserted automatically if required, there is a function for it.

-- Andy
luegner
Advanced
Advanced
Posts: 21
Joined: Fri Dec 12, 2003 6:49 pm

Menu Data Copy

Post by luegner »

Here's the good one:

_menuCloseDelay=100;_menuOpenDelay=100;_menuOpenDelay=100;_followSpeed=5;_followRate=0;_subOffsetTop=10;_subOffsetLeft=-10;_scrollAmount=3;_scrollDelay=20;retainClickValue=1;fixMozillaZIndex=true;
with(RootMenuStyle=new mm_style()){
borderstyle="solid";fontsize="12px";fontstyle="normal";fontweight="normal";fontfamily="Arial, Helvetica, sans-serif";padding="2";swap3d="1";pagecolor="#ffffff";pagebgcolor="#000000";headercolor="#000000";headerbgcolor="#FF0000";separatorcolor="#2E2C26";separatorsize="1";overfilter="Fade(duration=0.2);Alpha(style=0,Opacity=100);Shadow(color=000000, Direction=133, Strength=0);";outfilter="randomdissolve(duration=0.3)";
}
MainMenuStyle=new copyOf(RootMenuStyle)
MainMenuStyle.itemwidth="150";MainMenuStyle.align="center";MainMenuStyle.offcolor="#ffffff";MainMenuStyle.offbgcolor="#006600";MainMenuStyle.oncolor="#ffffff";MainMenuStyle.onbgcolor="#009900";MainMenuStyle.bordercolor="#000000";MainMenuStyle.borderwidth="1";MainMenuStyle.subimage="/images/arrow_right.gif";MainMenuStyle.subimagepadding="0";MainMenuStyle.subimageposition="right";MainMenuStyle.high3dcolor="#C6C2B9";MainMenuStyle.low3dcolor="#2E2C26";
SubMenuStyle=new copyOf(RootMenuStyle)
SubMenuStyle.itemwidth="150";SubMenuStyle.align="center";SubMenuStyle.offcolor="#ffffff";SubMenuStyle.offbgcolor="#006600";SubMenuStyle.oncolor="#ffffff";SubMenuStyle.onbgcolor="#009900";SubMenuStyle.borderwidth="1";SubMenuStyle.subimage="/images/arrow_right.gif";SubMenuStyle.subimagepadding="0";SubMenuStyle.subimageposition="right";SubMenuStyle.high3dcolor="#C6C2B9";SubMenuStyle.low3dcolor="#2E2C26";
with(dynamicmenu=new menuname("mainMenu")){
top="150";left="4";style=MainMenuStyle;menuwidth="150px";alwaysvisible=1;followscroll=1;orientation="vertical";keepalive=1;openstyle="ltr";overflow="scroll";
aI("text=Home;url=index.htm;");
}

Here's the one with px omitted in menuwidth (the one that throws an error). Also if I omit px from fontsize, it will also throw an error. Is that by design?

_menuCloseDelay=100;_menuOpenDelay=100;_menuOpenDelay=100;_followSpeed=5;_followRate=0;_subOffsetTop=10;_subOffsetLeft=-10;_scrollAmount=3;_scrollDelay=20;retainClickValue=1;fixMozillaZIndex=true;
with(RootMenuStyle=new mm_style()){
borderstyle="solid";fontsize="12px";fontstyle="normal";fontweight="normal";fontfamily="Arial, Helvetica, sans-serif";padding="2";swap3d="1";pagecolor="#ffffff";pagebgcolor="#000000";headercolor="#000000";headerbgcolor="#FF0000";separatorcolor="#2E2C26";separatorsize="1";overfilter="Fade(duration=0.2);Alpha(style=0,Opacity=100);Shadow(color=000000, Direction=133, Strength=0);";outfilter="randomdissolve(duration=0.3)";
}
MainMenuStyle=new copyOf(RootMenuStyle)
MainMenuStyle.itemwidth="150";MainMenuStyle.align="center";MainMenuStyle.offcolor="#ffffff";MainMenuStyle.offbgcolor="#006600";MainMenuStyle.oncolor="#ffffff";MainMenuStyle.onbgcolor="#009900";MainMenuStyle.bordercolor="#000000";MainMenuStyle.borderwidth="1";MainMenuStyle.subimage="/images/arrow_right.gif";MainMenuStyle.subimagepadding="0";MainMenuStyle.subimageposition="right";MainMenuStyle.high3dcolor="#C6C2B9";MainMenuStyle.low3dcolor="#2E2C26";
SubMenuStyle=new copyOf(RootMenuStyle)
SubMenuStyle.itemwidth="150";SubMenuStyle.align="center";SubMenuStyle.offcolor="#ffffff";SubMenuStyle.offbgcolor="#006600";SubMenuStyle.oncolor="#ffffff";SubMenuStyle.onbgcolor="#009900";SubMenuStyle.borderwidth="1";SubMenuStyle.subimage="/images/arrow_right.gif";SubMenuStyle.subimagepadding="0";SubMenuStyle.subimageposition="right";SubMenuStyle.high3dcolor="#C6C2B9";SubMenuStyle.low3dcolor="#2E2C26";
with(dynamicmenu=new menuname("mainMenu")){
top="150";left="4";style=MainMenuStyle;menuwidth="150";alwaysvisible=1;followscroll=1;orientation="vertical";keepalive=1;openstyle="ltr";overflow="scroll";
aI("text=Home;url=index.htm;");
}
Post Reply