NavBarMenu()

The NavBarMenu() function is used to create a custom menubar.

Synopsis

NavBarMenu(header width,item width)

Arguments

header width

Required. This is an integer value in pixels, that defines the width of the header content.

item width

Required. This is an integer value in pixels, that defines the width of the drop-down item content.

Description

The NavBarMenu() function is used to create a new menubar. To do so, we create a JavaScript variable, and initialize a new JavaScript object with the new operator in conjunction with the constructor function NavBarMenu().

Menubar Levels Fig. 1 Header and drop-down items of menubars

Example 1 - Defining a Custom Menubar

var hdr1Menu = new NavBarMenu(80, 125);
Fig. 2 Defining a JS variable as a new custom menubar

In the code sample in Fig. 2, a JavaScript variable called hdr1Menu is created, and it is declared to be a new NavBarMenu(). Argument header width is passed a value of 80 pixels. Argument item width is passed a value of 125 pixels.

The values of header width and item width need to be large enough to show all the available content for each level. It is a good practice to enter larger numbers at first, and evaluate how much width you actually need after you have rendered you webview. If you have excess width on the header level, or you need the space for other menubars, reduce the header width value.

The item width value is not as critical if it is too large, as the drop-down item levels of neighboring menubars are never present at the same time, thus it is okay if they are wider than they need to be to hold their content.