Examples

Examples - Measurement Units
Sometimes pixels just don't cut it... you might want to use inches, centimeters,
or percentages to lay out and define the sizes of your items. Some developers
find using the "em" unit more elegant because the size changes with the current
font size. Either way, we want you to be able to use any unit you want!
Note: We have not yet found a way to make elegant-looking cross-browser menus using only 'em' measurements. If anyone has ideas, let us know.
Changing units on a per-item basis
If you want to test the unit system, it's very easy to do so. Simply put the
two-letter code or a percentage sign after the number:
// Item array
'top':'12in', 'left': '10in',
'width':'1cm', 'height': '0.5cm'
Note that if you use different measurement units like that, WebDDM will not be
able to use offsets with positioning.
Unit Types
Here are the types of units you can use. There might be more, so if you know
of any let me know.
- '%' - Percentage, from 0-100. May not be the best unit to use.
- 'in' - Inches. May look different from computer to computer.
- 'cm' - Centimeters. May look different from computer to computer.
- 'mm' - Milliimeters (a tenth of one centimeter). May look different from computer to computer.
- 'px' - Good old pixels! If you don't set a measurement unit explicitly, it defaults to pixels.
- 'em' - If you don't want to use pixels, but you're afraid of the instability of centimeters and inches and percentages, then use this. '1em' is equal to the current font size, so your menus will stay nice-looking even if you change the font.
Default Measurement Unit
The default measurement unit in WebDDM is pixels. If you want to change this, set
the 'defaultMeasurementUnit' attribute in the base menu array:
var items = {
'defaultMeasurementUnit':'em',
// ... the rest of the menu goes here ...
};
If you want to use item offsets AND a unit measurement other than pixels, this is
the way to do it. Note, however, that you must type unit measurements as
just a number; for example, "15" is valid but "15em" is not if you want to use
offsets, even if "em" is the default measurement unit.
Multiple Measurement Units
Don't do it. Not only is it confusing, we're not sure if it even works right. If
many people request this ability we may add it, but can't you just use one
measurement unit? :)
View Source
View CSS file - View JavaScript file.
Examples
Examples: Last - Next