Hiermenus Go Forth, XXII - DHTML Lab | 4
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","https://www.webreference.com/experts/",1,0,1], ["Contents","https://www.webreference.com/index2.html",1,0,0], ["Services","https://www.webreference.com/index2.html",1,0,1], ["About","https://www.webreference.com/about.html",1,0,0] ]
top_is_variable_width
Value | Result |
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
Value | Result |
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
All Rights Reserved. Legal Notices.Created: August 21, 2001
Revised: August 21, 2001
URL: https://www.webreference.com/dhtml/column58/2.html