Individual itemwidth's for each main menu item [Solved]

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
thayvian
Beginner
Beginner
Posts: 1
Joined: Mon Jan 15, 2007 10:59 am

Individual itemwidth's for each main menu item [Solved]

Post by thayvian »

Hello everyone,

I don't see a way to specify different itemwidths for each of my main menu items. I only notice how the command itemwidth changes all the widths across the navbar. Any help would be greatly appreciated, thanks!

--Thayvian
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

http://milonic.com/styleproperties.php

This will set itemwidths the same for all menus that use the particular style where it is declared.

http://milonic.com/menuproperties.php

This will more or less do the same as the one with the styleproperties.

http://milonic.com/itemproperties.php

This applies the properties in the item and will only set it in that particular item.

Ruth
pedboy
Beginner
Beginner
Posts: 6
Joined: Sun Apr 22, 2007 5:38 pm

Re: Individual itemwidth's for each main menu item

Post by pedboy »

Perhaps i am being dumb here but i cant seem to make that work for me.


My site is here http://www.locodocs.co.uk

Ideally i want to add extra "top level" options to my menu without spreading the text over two lines - I would like to reduce the amount of space taken by the "Home" and "Misc" buttons to squeeze in the extra option, however if i try to do this the text wraps on the longer names whilst the home button shrinks a but, but not as much as it might.


Any ideas on how i can achive this?

if i " // " the "itemwidth" line for the top level everything squashes up but then there is a huge amount of dead space on the right (menu is alligned left)


menu files are available in the menu directory directly off the http://www.locodocs.co.uk/ thingy!
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Individual itemwidth's for each main menu item

Post by Ruth »

Hi,

itemwidth is also an item property so you can specify the width in each item, i.e. itemwidth=100; Below my names are links for different groups of properties, style, menu and item. Some of them pertain to just one level, i.e. margin, which is only a menu property. Some can pertain to two, and some to all three. So, you can code each main menu item with its own width.

Ruth
pedboy
Beginner
Beginner
Posts: 6
Joined: Sun Apr 22, 2007 5:38 pm

Re: Individual itemwidth's for each main menu item

Post by pedboy »

Ruth wrote:Hi,

itemwidth is also an item property so you can specify the width in each item, i.e. itemwidth=100; Below my names are links for different groups of properties, style, menu and item. Some of them pertain to just one level, i.e. margin, which is only a menu property. Some can pertain to two, and some to all three. So, you can code each main menu item with its own width.

Ruth
Okay i really am being dumb now!

Here is the bit of code for my top level...

Code: Select all


with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=0;
orientation="horizontal";
style=menuStyle;
top=0;
menuwidth="904px";
menualign="left";
itemwidth=100;
aI("text=Home;url=http://www.locodocs.co.uk/;");
aI("showmenu=Repair Books;text=Repair Books;");
aI("showmenu=Manufacturers Manuals;text=Manufacturers Manuals;");
aI("showmenu=BR Driver's Manuals;text=BR Driver's Manuals;");
aI("showmenu=Maintenance Guides;text=Maintenance Guides;");
aI("showmenu=Misc;text=Misc;");
}
Now if i change the itemwidth setting to say 50 it changes all of the menu top levels to 50.

What i want is to have say
Home = 50
Repair Books 100
Man Manuals 120
Misc 50

etc

Im sure this must be possible but im not sure where to stick the property.

It is the actual with of the menu button un-expanded that i want to change - i understand how to change the width of the drop-downs.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Re: Individual itemwidth's for each main menu item

Post by John »

As Ruth explained, by placing the itemwidth=100; where you have it now you are setting that value for that entire menu. Not what you want. You're after the individual items, so it would seem to make sense to set the property for each individual item within that menu...

Code: Select all

with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=0;
orientation="horizontal";
style=menuStyle;
top=0;
menuwidth="904px";
menualign="left";
aI("text=Home;url=http://www.locodocs.co.uk/;itemwidth=50;");
aI("showmenu=Repair Books;text=Repair Books;itemwidth=100;");
etc.

Please take another (or a first :D ) look at the reading she suggested.
John
pedboy
Beginner
Beginner
Posts: 6
Joined: Sun Apr 22, 2007 5:38 pm

Re: Individual itemwidth's for each main menu item

Post by pedboy »

John wrote:As Ruth explained, by placing the itemwidth=100; where you have it now you are setting that value for that entire menu. Not what you want. You're after the individual items, so it would seem to make sense to set the property for each individual item within that menu...

Code: Select all

with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=0;
orientation="horizontal";
style=menuStyle;
top=0;
menuwidth="904px";
menualign="left";
aI("text=Home;url=http://www.locodocs.co.uk/;itemwidth=50;");
aI("showmenu=Repair Books;text=Repair Books;itemwidth=100;");
etc.

Please take another (or a first :D ) look at the reading she suggested.
I didnt realise i could slip it into each line like that - i was trying to add it further down the code.

I have read the listing of attributes but wasnt sure how to implement them - basically where to stick them. But as ive never done anything like this before, nor have i had any IT training so i am just learing as i go (when i was at school we had BBC Micros!) im pretty chuffed with myself having got this far :-)

But once again many thanks.... Does the message board have a collections pot/charity where one can deposit a few quid to help pay for the upkeep/say thanks?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Individual itemwidth's for each main menu item

Post by Ruth »

Hi,

Those links below my name for the different properties, each one pertains the thing upon which it works and the place you can put it in the data file. So, styleproperties are ones you would put in the style section, menuproperties in the menu section i.e. the part that defines the menu, not the items, like alwaysvisible=;style=;top=; area, and then itemproperties are those that you can put directly into an item. So, let's say you wanted one item to have more padding and to have bold text, since those properties can be either a style property or an item property you could set them in the style section and then in that one item you would put padding=whatever;fontweight=bold; and that item would have more padding and it would have bold.

So, you can really fine tune things in the menu. As to your item widths, let's say you want them to be 100, but you want one to be smaller, then you'd code itemwidth=100; in the menu area and then in the item you want smaller you'd code itemwidth=50; or whatever you want. That should override the one set in the menu for that particular item. Hope that clears things :)

I think you need to contact Milonic about that pot/charity since it is their board. There might be some kind of revenue issue or something as a reason they don't do it.

Ruth
pedboy
Beginner
Beginner
Posts: 6
Joined: Sun Apr 22, 2007 5:38 pm

Re: Individual itemwidth's for each main menu item

Post by pedboy »

Yup i get it now and understand, as i am sure you can see if you look at the site.

Im just fine tuning it now :-) Im rather moer chuffed now :-)



Thanks all :-)
Post Reply