menustyle

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

menustyle

Post by Maz »

Does anyone know if a menu will work if there is no style above menu items?

And can I put style in menuitems?

Thanks,
maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Unknown, but I'd like to think there are some defaults built in.

Try it... :)
John
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Last time I took off style the menu disappeared, I could try to over-ride style in menuitem when the UK are asleep ;)

maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Don't wait. I think he's still up 24/7... :!:
John
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I played around with it jsut out of curiosity. I didn't declare any style in the head of my document, just put everything in the body tag for the bgcolor, font links etc of the page, then I tried eliminated any style reference to my submenus and went from there, this is the result.

1. I had to create a style, but I could leave it empty, only name it like this with(main=new mm_style()){}
2. I had to declare a style in the menu itself or I got an error

The menu took on the bgcolor and font color of the page for any item that only opened a submenu, but for any item that was a link it became the color listed for links.
I tried putting a different style for one item but that didn't seem to change the style.

Ruth
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

So you have to have a menu style=.

I was wondering about putting different styles in each menu item ;)

Instead of changing a menuitem like offcolor etc, using style=menustyle; in the item.

Maybe that does work then,

Thanks,
maz
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Maz,

You could declare a base or default style for common or default features, like borderstyle, borderwidth, etc. As you know, most of the menu style properties are also represented as menu item properties. That way, you can override a style setting that normally applys to the whole menu, and specify a different value to use on an item-by-item basis. With that in mind, you can take advantage of the fact that the argument to the aI() function is all in a long string, and do some string manipulations to create "item styles". Suppose, for example, that you have a style like so:

Code: Select all

with(menuStyle=new mm_style()){
onbgcolor="#4F8EB6";
oncolor="#ffffff";
offbgcolor="#DCE9F0";
offcolor="#515151";
bordercolor="#296488";
borderstyle="solid";
borderwidth=1;
separatorcolor="#2D729D";
separatorsize="1";
padding=5;
fontsize="75%";
fontstyle="normal";
fontfamily="Verdana, Tahoma, Arial";
pagecolor="black";
pagebgcolor="#82B6D7";
headercolor="#000000";
headerbgcolor="#ffffff";
subimage="arrow.gif";
subimagepadding="2";
}
You could define an "item style" string in your menu_data.js file like this:

Code: Select all

itemStyle1 = "onbgcolor=#000000;oncolor=#0000FF;";
Define as many menu item properties in this string as you like, placing the entire string inside double quotes, separating each property from the next with a ; and ending the whole string with a ; inside the closing ".

Define as many different "item styles" as you want like this. To use one in a menu item definition, you would define the properties that are unique to the particular item, as usual (like text= and url=), and append the itemStyle to the end, like this:

Code: Select all

aI("text=Your Text;url=yourUrl.htm;"+itemStyle1);
This way, you could re-use any itemStyle you want in any item definition, as often or as little as you like. You don't have to keep typing all of the individual property definitions for each different menu item. And you can easily change the itemStyle that you've applied to multiple items simply by editing the string.

You could take the approach a step further and break the "item styles" into various parts, like "off styles" and "on styles", like so:

Code: Select all

offStyle1 = "offbgcolor=#FFFFFF;offcolor=#000000;subimage=arrow-off.gif;";
onStyle1 = "onbgcolor=#000000;oncolor=#FFFFFF;onsubimage=arrow-on.gif;";
Then combine them in a menu item definition like so:

Code: Select all

aI(text=Your Text;url=yourUrl.htm;"+offStyle1+onStyle1);
Is that the sort of thing you're after?

Kevin
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Kevin,

I didn't know that one, I'll have to go over it carefully.

I had a style but the padding was different, could I have added top, right, bottom, left padding to the menu item?

I added a few styles yesterday, remember Ruth asked about 3d, I just noticed today I have no separators. Where did they go?

maz
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Maz,

Yep... you can specify padding as a menu item property, overriding the padding set in the menu's style. It might also be worth mentioning that when you define your "item style" strings, you could do so across multiple lines of code, likes this:

Code: Select all

itemStyle1="\
offbgcolor=#000000;\
onbgcolor=#FFFFFF;\
offcolor=#FFFFFF;\
oncolor=#000000;\
padding=5 50 5 50;\
"
The advantage here would be that you set one property per line, so it might be easier to edit and manage that way. Just remember to end each line, except the last one, with a backslash (\) as shown above.

Don't know about your separators, but I'll take a look in a bit.

Cheers,

Kevin
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

All these styles could get confusing.

It may be that the separators look fine on a pc, but what I'm seeing is the background through the separators where the separator should be.

I have another separator when logged in and that one works fine, the only difference is that there is no image background with bgcolor transparent.

Thanks,
maz

nb. Kevin, please can you take a look at the post "IE mac popup function" he needs some js help.
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I got it back, first I had to change 3d to 3D, that put the separators back in. Then I removed separatorpadding that removed transparency.

Thanks,
maz
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

No I'm not going insane 8)

with 3D I get separators with bordercolor, but no 3D borders,

with 3d I get no separators but 3d borders.


maz
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I'm trying out new ways with images since there are a lot more styles than originally, so far imagepadding is not responding (neither to the menu border nor text).

maz
Post Reply