spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com


home / experts / dhtml / column58

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
Logo

Hiermenus Go Forth, XXII:
Version 4.1 - The Complete Script (Full-Window)



Variable Width Syntax

Two new parameter elements have been added to each top-level menu array, top_is_variable_width and tree_is_variable_width.

Their inclusion is optional. They both default to false. That is, you do not need to include them unless you want to specify a value other than false.

An example top-level menu array:

HM_Array1 = [
[100,          // menu width                  [ new behavior! ]
70,            // left_position
170,           // top_position
"red",         // font_color
"yellow",      // mouseover_font_color
"yellow",      // background_color
"black",       // mouseover_background_color
"blue",        // border_color
"green",       // separator_color
1,             // top_is_permanent
1,             // top_is_horizontal
0,             // tree_is_horizontal
1,             // position_under
false,         // top_more_images_visible
1,             // tree_more_images_visible
"null",        // evaluate_upon_tree_show
"null",        // evaluate_upon_tree_hide
false,         // right_to_left
false,         // display_on_click
true,          // top_is_variable_width       [ new parameter! ]
false,         // tree_is_variable_width      [ new parameter! ]
],
["Experts","http://www.webreference.com/experts/",1,0,1],
["Contents","http://www.webreference.com/index2.html",1,0,0],
["Services","http://www.webreference.com/index2.html",1,0,1],
["About","http://www.webreference.com/about.html",1,0,0]
]

top_is_variable_width


ValueResult

true,
1,
JS expression that evaluates to true or 1
The top-level menu in the menu tree will be variable width.

If it is a horizontal menu, all items will be as wide as their text content up to a maximum width specified by the menu_width parameter. The menu will be as wide as the total width of all the items.

If it is a vertical menu, all items and, consequently, the menu itself will be as wide as the widest item in the menu to a maximum width specified by the menu_width parameter.


false,
0,
JS expression that evaluates to false or 0
The top-level menu in the menu tree will be fixed width.

If it is a horizontal menu, all items will be as wide as the value of the menu_width parameter. The menu will be as wide as the total width of all the items.

If it is a vertical menu, all items and, consequently, the menu itself will be as wide as the value of the menu_width parameter.


tree_is_variable_width


ValueResult

true,
1,
JS expression that evaluates to true or 1
All child menus in the menu tree will be variable width.

If they are horizontal menus, all items will be as wide as their text content up to a maximum width specified by the menu_width parameter. Each menu will be as wide as the total width of all its items.

If they are vertical menus, each menu and its items will be as wide as the widest of the items to a maximum width specified by the menu_width parameter.


false,
0,
JS expression that evaluates to false or 0
All child menus in the menu tree will be fixed width.

If they are horizontal menus, all items will be as wide as the value of the menu_width parameter. Each menu will be as wide as the total width of all its items.

If they are vertical menus, each menu and its items will be as wide as the value of the menu_width parameter.


menu_width

You'll have noticed that the menu_width parameter is still important even if menus are specified to be variable width.

In a fixed menu width context menu_width specifies the actual width of the menu.

In a variable menu width context menu_width specifies the maximum width of the menu.

You may want variable widths for the menus with short displayed text, but the occasional long text item should be constrained. We can achieve both with the new menu_width behavior.



On the next page, some illustrations of variable width menus.


Produced by Peter Belesis and

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags

All Rights Reserved. Legal Notices.
Created: August 21, 2001
Revised: August 21, 2001

URL: http://www.webreference.com/dhtml/column58/2.html