Tigra Menu Gold is a cross browser Javascript Menu navigation component for web sites. Script provides efficient supporting of most complete feature set.
This is what we call the most complete feature set:
Tigra Menu GOLD is designed to efficiently employ maximum capabilities of the visitor's browser while keeping code size compact for both script files and configuration.
Here is a table of the application compatibility:
Platform | Browser | |||||
---|---|---|---|---|---|---|
MS IE | Netscape | Mozilla | Opera | AOL | Safari | |
Windows 95/98/ME/2000/XP | 4.0+ | 4.08+ | 0.9+ | 5.0+ | 4+ | n/a |
Mac OS 8/9/X | 5.0+ | 4.7+ | 1.0+ | 5.0+ | n/a | 1.0+ |
KDE on Linux/FreeBSD | n/a | n/a | 1.1+ | n/a | n/a | n/a |
Although all data required for menu to function properly may reside in single html document it is not efficient in most cases. Dividing data into several files makes menu maintenance easier. This technique also reduces network load allowing clients to use cached files on sites with multiple pages.
Default configuration contains:
File indexes may be added to file names and structure names if multiple menus used. For example style sheet for menu with index 1 may have name menu1.css.
All menu.css, menu.js, items.js and template.js files should be attached to HTML document with appropriate tags in header:
<head> <!-- some header data --> <link rel="stylesheet" href="menu.css"> <script language="JavaScript" src="menu.js"></script> <script language="JavaScript" src="items.js"></script> <script language="JavaScript" src="template.js"></script> </head>
Script automatically links portion of code that best employs capabilities of the browser visitor uses. Modify TMenu_path_to_files variable in menu.js for script to know where to look for menu files
var TMenu_path_to_files = 'menu_files/';
Always make sure pixel.gif file is located by the path specified in TMenu_path_to_files as well as menu core file (menu.js) and browser-dependent library files (menu.dom.js, menu.lay.js and menu.opr.js).
In order for the menu to work, all required files should be included into HTML document. Then a function of menu constructor - new menu() - is called for each menu instance on the page. Constructor for each menu receives two to three parameters:
Menu scope setting structure is JavaScript structure to set global menu behavior parameters. Below is a table of keys supported by the structure
Key | Description | Accepted Values | If omitted or null the menu ... |
---|---|---|---|
frames | Supplies to a menu how frames it should operate through are located in a frameset | 2-dimentional array of strings | ... works like not in a frameset |
key | Alternative key name for the menu | a string | ... takes zero-based index of all menus on a page in an order of how they are called |
forms | Makes submenu blocks to hide select boxes of specified HTML form elements on menu drop-down (pop-up) if select boxes can not be overlapped in a browser | array of strings those are form names | ... does not hide select boxes if they can not be overlapped |
popup | Makes menu root level to be initially invisible and to become invisible on total menu collapse. If contains a name of existing image on current page, menu root level offsets will be relative to that image top left corner |
any | ... root level is initially visible |
zIndex | Menu base z-index, is stating counting point for all menu z-indexes. Set its value if menu is needed to overlap certain other layers in the HTML document | an integer number | ... root level has z-index of 0 |
showroot | A value adequate to JavaScript true makes menu root level to be always visible if cross-frame. Useful when menu root level partialy located in other than master frame. Makes sence in only cross-frame mode. | boolean | ... slave copy will hide its root level |
wrapper | A JavaScript function "wrap" menu items content with. It is to be called while every item building and item content and its state as two parameters. Function shold return appropriate content for the item. | a function | ... menu items' content will not be additionally processed |
Event processing | |||
clickcollapse | Switches menu collapse after any item click to be on. | boolean true of false | ... will not be collapsed on any item click unless 'cc' item scope structure key says the opposite |
onexpand | A JavaScript function to be called before menu expansion if it is collapsed. Usefull for hiding objects on the page that can not be covered with submenus. |
a function | ... no function will be called instead |
oncollapse | A JavaScript function to be called after total menu collapse. Usefull for showing objects hidden with onexpand key handler. |
a function | ... no function will be called instead |
Any of the above keys can be omitted.
By default Tigra Menu GOLD root level is always visible on the page. However, there is a way to make it hidden and appearing/disappearing only on certain event. Such behavior is available when the menu is in pop-up mode. It can be useful if you wish to build context menus, for instance.
To switch menu pop-up mode on just specify a value not equal to 0, null or '' for 'popup' key of menu scope settings structure. Menu root level will be initially hidden then.
To show the root level just handle expand() menu method call on desired event and to hide it place onmouseout(0) menu method call. Suppose you have a menu appearing when mouse pointer hovers over "show menu" link and disappearing when the pointer goes away from it. Here are the code samples:
<script language="JavaScript"> myMenu = new menu (MENU_ITEMS, MENU_POS, {'popup' : 1}); </script> <!-- any HTML code here --> <a href="" onmouseover="myMenu.expand()" onmouseout="myMenu.onmouseout(0)">show menu</a>
In above example myMenu is a variable reference to a menu object. Such way helps to identify the menu.
Browsers such as Netscape Navigator 4.x and Opera 6.x- are unable to render any HTML element to overlap HTML form controls, so Tigra Menu GOLD is built to hide HTML forms at all for those browsers. To make this feature work you should place a form to be hidden on menu expanding into HTML element which can be hidden by JavaScript, for instance, <div style="position:relative"> tag. If there are several forms to make hidable in a document, place each of them into such tags. Then give names and ids to all of those tags: <div style="position:relative" name="toHide" id="toHide">. Now just pass an array of the above block names or ids as a fifth parameter to a menu initialization block:
<script language="JavaScript">
// build a menu which will hide 2 forms if expanding in NN4.x or Opera
new menu (MENU_ITEMS, MENU_POS, {'forms' : ['toHide0', 'toHide1']});
</script>
Symbolic name can be assinged to the menu instance. It is useful when you use several menu instances across a frameset to avoid menu initialization blocks to mix menus up. Then this name can be used instead of numeric menu index for instance references. To set a name for the menu put string value as last parameter of menu initialization block:
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS, {'key' : 'myGold'}); </script>
Menu initialization block should be placed where you want to see the Menu on your web page:
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS); </script>
Case with three menus on the page may look like:
<script language="JavaScript"> new menu (MENU_ITEMS1, MENU_POS1); new menu (MENU_ITEMS2, MENU_POS2); new menu (MENU_ITEMS3, MENU_POS3); </script>
Tigra Menu GOLD can be configured to work with web sites utilizing frames. Menu blocks can overlap frame borders as if page was solid HTML document.
The Dynamic HTML (DHTML) and Document Object Model (DOM) don't provide native support for this feature that's why this popular feature is not offered by most JavaScript menus. The elements menu is built of can't extend beyond the edge of the document they were created in. We solve the problem by creating the fragments of the menu in different frames and then synchronizing them so they look and act as one menu. This trick comes with some limitations that you should be aware of:
Above requirements only apply to documents in frames that menu will overlap (cover).
Follow steps below to configure Tigra Menu GOLD for usage with frames:
1. Link menu files and add menu initialization block to all HTML documents menu can appear over
Example: If some document is expected to be loaded in content frame of your site then you should insert menu code into it
Document's header:
<head> <!-- some header data --> <link rel="stylesheet" href="menu.css"> <script language="JavaScript" src="menu.js"></script> <script language="JavaScript" src="menu_items.js"></script> <script language="JavaScript" src="menu_tpl.js"></script> </head>
Document's body:
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS); </script>
Insert menu initialization blocks just before </body> tags in all content (slave) documents. Master document - the one that loads in navigation frame, should have initialization block correctly positioned in the code, as it is done in a single-frame case.
The moment of choosing 'master' is essential regardless of which frameset and of how many frames you are building: one frame which does not tend to be reloaded should be chosen as 'master' for the menu.
2. Once we insert 'master' <script></script> tags into its source exactly in the place we want the menu to appear we are ready to compose frameset description structure - JavaScript array, containing line-by-line column-by-column frames' names. For instance, frameset looking like this:
A | B | |
C | D | E |
should be described as:
var MENU_FRAMES = [ ['A', 'B'], ['C', 'D', 'E'] ]
If framesets are nested (one of the frames contains html document with frames) then frame is referenced with parent and own name separated by a dot (.).
3. Specify the name of frameset description structure as third parameter in menu initialization block of the master frame.
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS, {'frames' : MENU_FRAMES}); </script>
If you use several cross-frame menu instances, you should use the same predefined menu indexes as the last parameter at initialization blocks for all frames a menu will operate through to avoid slave menus mixing up.
Master frame:
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS, {'frames' : MENU_FRAMES, 'key' : 'myMenuGold'}); </script>
Slave frame(s):
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS, {'key' : 'myMenuGold'}); </script> </body> </html>
Notes: Nested frames support is implemented in versions 1.2 and later.
Framesets looking like
A | B |
C |
are supported in versions 2.4 and later. The description structure for such sample is the following:
var MENU_FRAMES = [ ['A', 'B'], ['A', 'C'] ]
Even if the menu is needed to operate in only one frame of a frameset the frameset description structure should be supplied to the menu constructor. For instance, of the above sample frameset you need a menu in only frm0 frame, the constructor call for that frame (no calls needed in other frames) will look like:
<script language="JavaScript"> new menu (MENU_ITEMS, MENU_POS, {'frames' : [['frm0']]}); </script>
Menu items are JavaScript structure that describes menu elements and they relations in menu hierarchy. Item's individual parameters are configured within this structure as well.
Structure assigned array value with list of root items. Each item is array itself containing one or more elements. Those elements are:
Notes:
Caption defines text or html that will be printed within item's rectangle. This field may be assigned string or three element array with captions for different states of item. Those states are:
Picture and code sample below show how caption is defined for menu item.
var MENU_ITEMS = [ // level 0 item 0 [[ '<span style="color: green;">State is mout</span>', '<span style="color: orenge;">State is mover</span>', '<span style="color: red;">State is mdown</span>', ], "javascript: alert('Click!')"], // level 0 item 1 ['Contact', "mailto:[email protected]"] ]
Link defines text to be inserted into href attribute of item's anchor tag. Usually this is page URL, but any appropriate value is possible.
var MENU_ITEMS = [ ['level 0 item 0', 'http://www.softcomplex.com/'], // Site URL ['level 0 item 1', 'ftp://ftp.microsoft.com/'], // Link to FTP ['level 0 item 2', 'mailto:[email protected]'], // Mailto link ['level 0 item 3', 'javascript:alert("Hello World!");'], // Script statement ];
Any item may have unlimited count of sub items. All sub items are defined using the same rules as were used for creation of the item itself. See code sample above.
By default Menu Template settings are located in menu_tpl.js file but they can be moved to any other JavaScript file linked to the HTML document containing the menu. This configuration code can also be inserted within <script> tag into HTML document itself.
Menu template structure is JavaScript associative array that describes how menu blocks and items are positioned and sized, how they look and behave at each level. Below is the list of supported keys with descriptions.
Configuration keys for menu level scope settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Each level of menu is configured independently. But there is a way to inherit configuration from previous menu level, e.g. if second and third menu level configurations are identical you don't need to describe the third level in the configuration settings. Level configuration will be inherited from the previous level if omitted or declared as JavaScript null. For instance:
{ // Level 3 configuration |
Can be replaced with |
{ // Level 3, 4 configurations |
Parameters assigned array value. Each element of array corresponds menu level with the same index. More levels expected - more elements required for each parameter. Given menu example has four levels so all arrays have four elements as well.
By default Tigra Menu GOLD is positioned relatively. It means the menu root level will be drawn out in a place where its constructor (new menu()) is called. So you can place the menu in any containing HTML element, e.g <table> and align it on the page in the way you wish.
However, there is a way to position the menu on the page relatively to its top left corner, absolutely. It is useful when the menu is desired to cover certain HTML elements.
To switch absolute positioning on just set a value for block_left and/or block_top keys of menu root level scope settings structure. The menu root level will be shifted from the page top left corner by block_left pixels rightward and by block_top pixels downward. If both keys are omitted for menu root level the menu will be positioned relatively.
Picture and code sample below show how menu size and offset parameters are set with JavaScript structure. Cases illustrated are highlighted in code sample with blue background.
var MENU_POS0 = [
// Level 0 block configuration { 'height': 25, 'width': 100, // C. 'table': [0, 1, 0],
'vertical' : false
}, // Level 1 block configuration {
'width' : 130, // A.
'height' : 25, // B.
'table' : [0, 1, 0],
'block_top' : 20,
'block_left' : 11, 'vertical' : true
}, // Level 2 block configuration { 'height' : 25, // D.
'width' : 160,
'table' : [0, 1, 0], 'block_top' : 10, // F. 'block_left' : 120, // E.
'vertical' : false
} ]
Items of menu blocks of certain level can follow each other either vertically or horizontally. That is set by 'vertical' key of configuration description structure for the correspondent menu level:
|
|
||||||||
{ |
{ |
All menu block items are included into a table. Cellpadding, cellspacing and border modifiers for such table of the certain level are assigned to a JavaScript array with key of 'table' of configuration description structure for the correspondent menu level
|
{
'height' : 20,
'width' : 120,
'table' : [0, 5, 2],
'vertical' : true,
}
If operating in a single frame menu can be configured so that blocks always appear on a visible page area if it is possible. There are two ways of block behaviour once not fit onto page frame:
Block is flipped relatively to its left upper corner:
{ |
Block is shifted to the window border:
{ |
All other values of wise_pos key are supposed to be 0 e.g. wise positioning is off (always if multiple frames).
Transition effect settings are taken into account for MS Internet Explorer 5+ browsers only. Effect can be applied on block expand and/or on block collapse. There is a way to set an effect for menu level scope and for separate submenu block as well
'transition' key is 2-celled array, the first one an effect for a submenu expansion and the second one is for the submenu collapse. Each cell can have one of the following values (are given with their descriptions):
Effect string value | Description |
---|---|
revealTrans(TRANSITION=0,DURATION=t) | Box in |
revealTrans(TRANSITION=1,DURATION=t) | Box out |
revealTrans(TRANSITION=2,DURATION=t) | Circle in |
revealTrans(TRANSITION=3,DURATION=t) | Circle out |
revealTrans(TRANSITION=4,DURATION=t) | Wipe up |
revealTrans(TRANSITION=5,DURATION=t) | Wipe down |
revealTrans(TRANSITION=6,DURATION=t) | Wipe right |
revealTrans(TRANSITION=7,DURATION=t) | Wipe left |
revealTrans(TRANSITION=8,DURATION=t) | Vertical blinds |
revealTrans(TRANSITION=9,DURATION=t) | Horizontal blinds |
revealTrans(TRANSITION=10,DURATION=t) | Checkerboard across |
revealTrans(TRANSITION=11,DURATION=t) | Checkerboard down |
revealTrans(TRANSITION=12,DURATION=t) | Random dissolve |
revealTrans(TRANSITION=13,DURATION=t) | Split vertical in |
revealTrans(TRANSITION=14,DURATION=t) | Split vertical out |
revealTrans(TRANSITION=15,DURATION=t) | Split horizontal in |
revealTrans(TRANSITION=16,DURATION=t) | Split horizontal out |
revealTrans(TRANSITION=17,DURATION=t) | Strips left down |
revealTrans(TRANSITION=18,DURATION=t) | Strips left up |
revealTrans(TRANSITION=19,DURATION=t) | Strips right down |
revealTrans(TRANSITION=20,DURATION=t) | Strips right up |
revealTrans(TRANSITION=21,DURATION=t) | Random bars horizontal |
revealTrans(TRANSITION=22,DURATION=t) | Random bars vertical |
revealTrans(TRANSITION=23,DURATION=t) | Random of all above |
blendTrans(DURATION=t) | Blending effect |
progid:DXImageTransform.Microsoft.Wheel(DURATION=t,spokes=5) | |
progid:DXImageTransform.Microsoft.Barn(DURATION=t,orientation=horizontal) | |
progid:DXImageTransform.Microsoft.Blinds(DURATION=t,bands=5) | |
progid:DXImageTransform.Microsoft.CheckerBoard(DURATION=t) | |
progid:DXImageTransform.Microsoft.Fade(DURATION=t) | |
progid:DXImageTransform.Microsoft.GradientWipe(DURATION=t,wipeStyle=0) | |
progid:DXImageTransform.Microsoft.Iris(DURATION=t,irisStyle=STAR) | |
progid:DXImageTransform.Microsoft. (DURATION=t,irisStyle=CIRCLE) | |
progid:DXImageTransform.Microsoft.Pixelate(DURATION=t,maxSquare=40) | |
progid:DXImageTransform.Microsoft.Wheel(DURATION=t,spokes=5) | |
progid:DXImageTransform.Microsoft.RandomDissolve(DURATION=t) | |
progid:DXImageTransform.Microsoft.Spiral(DURATION=t) | |
progid:DXImageTransform.Microsoft.Stretch(DURATION=t,stretchStyle=push) | |
progid:DXImageTransform.Microsoft.Strips(DURATION=t,motion=rightdown) |
Note: In above table t stands for an effect duration time in seconds
If you would like to have horizontal blinds for a half a second both for expand and collapse just specify:
'transition': ['revealTrans(TRANSITION=9,DURATION=0.5)', 'revealTrans(TRANSITION=9,DURATION=0.5)']
As mentioned above any menu item may have three states: when mouse pointer is out of the item ("mouseout"), over the item ("mouseover") and item click ("mousedown"). With Tigra Menu Gold it is possible to define styles for a whole block and for any state for any level of any menu on the page.
Caption of any item is printed within two tags basically like this:
<div class="some_class_for_outer_tag">
<div class="some_class_for_inner_tag">
caption text
</div>
</div>
Styles may be defined for both tags. Usually attributes for item rectangle are assigned to outer tag (i.e. background, border etc.) and attributes for text to inner tag (i.e. font, size, color etc.)
Each level can have css key in its configurational structure. This key may contain the following subkeys:
table - style class name for <div> tag which every menu block table is included into
outer - for item's outer tag; if JavaScript array then contains style class names for each item's state [mouseout, mouseover, mousedown]; if string then is style class name for all item's states
inner - for item's inner tag; if JavaScript array then contains style class names for each item's state [mouseout, mouseover, mousedown]; if string then is style class name for all item's states
Any of css key subkeys can be omitted as well as the whole css key.
Here is a sample of css structure:
'css' : {
'table' : 'menu0table', // menu block table
'outer' : ['menu0outo', 'menu0overo', 'menu0downo'], // item's outer tag: [mouseout, mouseover, mousedown]
'inner' : 'menu0inner' // item's inner tag, the same class for all states
}
You should note that not all browsers render style sheets the same. Always test your configuration with all versions expected.
Tigra Menu GOLD item scope settings can be defined locally for particular item. Logically item scope settings take precedence of level scope settings, so if assigned, the local value overrides one set for whole menu level.
Item scope settings are defined in form of associative array which specifies local settings for item target, sizes, hint message, window status bar message, submenu block offsets and sizes. This structure is inserted as third parameter of the item in hierarchy structure. Menu template structure is JavaScript associative array which defines default item sizes, submenu block offsets, orientation, expand and collapse delays, transition effects, shadow settings and styles. Below there is a list of supported keys with their descriptions.
Configuration keys for menu item scope settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Notes:
Any HTML is allowed within items caption (see Building Menu Hierarchy). This makes Tigra Menu GOLD powerful dynamic pages building engine that allows easy creation of professional sites without even worrying about browsers that clients use. With those features you may write cascading pages with images and so forth.
Suppose you have several menu items to be filled with a complex HTML code and having a difference in only their captions. The simpliest way of including such items in menu hierarchy is to repeat the same HTML code for as many times as a number of similar items you need is. But there is a way to get rid of those repeating. You can use special JavaScript functions to attach the same or similar HTML code to certain menu item captions - to wrap them with an additional code. We call such funtions wrappers herein. Wrappers symplify menu maintenance and reduce network usage as well.
Tigra Menu GOLD supports
Global wrapper is a JavaScript function to add an additional HTML code to a caption of every menu item. It is called while menu script builds an item and receives two parameters:
1 - a caption of menu item to be wrapped, string
2 - a state of item at which the wrapper has to be applied, number
The function has to return a string which will be used instead of item caption.
To assign a function to be a global wrapper for the menu specify a reference or definition of the function as a value for wrapper key of menu scope setting structure.
There is a sample wrapping function code below:
function myWrapper (s_text, n_state) {
// an array of colors for all three item states
var a_colors = ['green', 'orange', 'red'];
return '<span style="color: ' + a_colors[n_state] + ';">' + s_text + '</span>';
}
// Sample menu constructor line to plug the funtion to the menu
myMenu = new menu (MENU_ITEMS, MENU_POS, {'wrapper' : myWrapper});
Above defined function will return green menu item text for normal, orange for mouseovered and red for clicked menu item state.
If only certain menu item are needed to be wrapped or there several different wrapping functions are to be used it is rational to use in-hierarchy wrappers. The concept is to declare such functions separately and than use their references directly in menu item hierarchy declaration. Having demo structure from section of Building Menu Hierarchy in-hierarchy wrappers may look like the following:
function wrap_grn (text) { return '<span style="color: green;">' + text + '</span>'; } function wrap_org (text) { return '<span style="color: orange;">' + text + '</span>'; } function wrap_red (text) { return '<span style="color: red;">' + text + '</span>'; } var MENU_ITEMS = [ // level 0 item 0 [[wrap_grn('State is mout'), wrap_org('State is mover'), wrap_red('State is mdown') ], "javascript:alert('Click!')"], // level 0 item 1 ['Contact', "mailto:[email protected]"], ];
or even simplier solution:
function wrap (text, color) { return '<span style="color: ' + color + ';">' + text + '</span>'; } var MENU_ITEMS = [ // level 0 item 0 [[wrap('State is mout', 'green'), wrap('State is mover', 'orange'), wrap('State is mdown', 'red') ], "javascript:alert('Click!')"], // level 0 item 1 ['Contact', "mailto:[email protected]"], ];
This technique may not pay much on small menu hierarchies or if only few items have html decoration, but it definitely should be used on large menus with rich formatting within items.
Code of the wrappers may be saved together with menu items structure in the same file, keeping clear logical structure of menu configuration.
As you could see it is possible to achieve the same visual effects with both styles and inner html. Although styles are easier to manipulate and experiment with, inner html may provide higher browser compatibility level. It is highly desirable to use generic compatible html within items together with wrappers if all potential of Tigra Menu Gold is required no matter what browser version is used.
One Regular Tigra Menu GOLD script license gives the right to use one copy of the script (all copies of files: menu_files/menu.js, menu_files/menu.dom.js, menu_files/menu.lay.js, menu_files/menu.opr.js) within single domain boundaries.
Demo of Licensing Cases: | ||||||||||||
|
To finalize registration process owner of the script license should provide SoftComplex Inc. with domain name which license is associated with.
Developer license gives the right to include unlimited number of Tigra Menu GOLD instances in the products of license owner. Such kind of license is obtained automatically by those who have 9 or more regular licenses.
We offer 50% discount for the script starting from second license. To take advantage of this discount use the link sent with every order confirmation message.
Same discount initially applies to educational and religious organizations.
As owner of the Tigra Menu Gold license You are allowed to configure the script in any possible way for use in Internet (public), Intranet (corporate) or offline application, however You are strictly NOT allowed (unless specifically authorized by SoftComplex.com) to:
You are entitled to free product upgrades and technical support for at least one year from the date of purchase. Technical support includes answers to script related questions via e-mail and/or Internet instant messaging services. Full customization services are provided on customer's request at additional charge.
Should you violate these Terms and Conditions or any other rights of SoftComplex Inc., SoftComplex Inc. reserves the right to pursue any and all legal and equitable remedies against you without limitation.