Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:41

menustyle


Poster: Maz
Dated: Monday February 23 2004 - 19:21:52 GMT

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


Poster: John
Dated: Monday February 23 2004 - 19:43:26 GMT

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

Try it... :)


Poster: Maz
Dated: Monday February 23 2004 - 20:05:11 GMT

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

maz


Poster: John
Dated: Monday February 23 2004 - 20:14:43 GMT

Don't wait. I think he's still up 24/7... :!:


Poster: Ruth
Dated: Tuesday February 24 2004 - 1:53:50 GMT

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


Poster: Maz
Dated: Tuesday February 24 2004 - 2:43:47 GMT

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


Poster: kevin3442
Dated: Tuesday February 24 2004 - 5:52:59 GMT

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:
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:
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:
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:
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:
aI(text=Your Text;url=yourUrl.htm;"+offStyle1+onStyle1);


Is that the sort of thing you're after?

Kevin


Poster: Maz
Dated: Tuesday February 24 2004 - 6:45:09 GMT

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


Poster: kevin3442
Dated: Tuesday February 24 2004 - 16:29:09 GMT

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:
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


Poster: Maz
Dated: Tuesday February 24 2004 - 16:51:11 GMT

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.


Poster: Maz
Dated: Tuesday February 24 2004 - 18:54:51 GMT

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


Poster: Maz
Dated: Tuesday February 24 2004 - 21:21:06 GMT

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


Poster: Maz
Dated: Wednesday February 25 2004 - 5:21:49 GMT

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