Multiple Styles Menu |
Multiple Styles Menu |
The Multiple Styles Menu sample demonstrates the menus
flexibility when it comes to using different text, colors and styles. There
are very little restrictions when it comes to declaring these kind
of properties.
Style properties can be declared in a global style, menu or menu item
using the standard menu property pairs variablename="value";
declaration. If a property is not needed it can be removed from the data file completely; there is very little point declaring a variable if the default value is all that is required. This allows you to construct a menu data file using the minimum of bytes needed, assisting in a quicker download of the menu. It also helps make the data file easier to understand as it isn't full of redundant parameters. Note that the structure of the menu data file is as close to being Object Oriented as JavaScript will allow. JavaScript itself is not an Object Oriented language but is an Object Based language. So, from this sample you can see that each menu can have its own style if this is your requirement. Normally though, only one style is needed but there are instances where you may want the top level (horizontal) menu to have a different setup than your sub (vertical) menus. This can be achieved by declaring more than one style as you can see by the code below. Creating different styles is useful for changing many of the properties of a style completely, but what if you only wanted to change, say one or two parameters. The most efficient way of doing this is by creating a new style based on values from another style. The copyOf() function is the tool for this job. Here is an example: with(verticalStyle=new mm_style()){ The
above sample code, creates a global style that will be used for all
vertical submenus called, verticalStyle. If you wanted to use the
same style for your horizontal menu but you needed the submenu
indicator image changing, you could create a copy of the
verticalStyle with the copyOf() function giving your
new style a name of horizontalStyle. |
- Dynamic Downloads are possible for the Multiple Styles Menu demo
- The code for this menu sample will be generated on the fly and compiled into a .ZIP file format for downloading onto your own machine.
Click here to download this sample
Note that you need to be logged in to download the menus and the download delivered will depend on your current license status.