YUI Library Home

YUI Library Examples: Menu Family: Website Left Nav Using Animation With Submenus Built From Markup

Menu Family: Website Left Nav Using Animation With Submenus Built From Markup

This example demonstrates how to create a traditional, two-column page layout (using Grids) with a set of animated fly-out menu navigation in the left column.

Begin by placing the markup for the two-column Grid on the page (this example uses the Grids Preset Template 1, 160px left). Next add the Menu markup to the left column of the grid.

Use the onContentReady method of the Event utility to instantiate the Menu as soon as its markup is available for scripting.

This Menu instance makes use of several configuration properties. Setting the "autosubmenudisplay" configuration property to "true" modifies its default behavior so that mousing over any item in the Menu automatically triggers the display of its submenu. The "hidedelay" configuration property is set to "750" so each submenu automatically hides 750ms after the user's mouse has left the menu. The "lazyload" property is set to "true" to help speed up the initial load time of the Menu instance by deferring the initialization and rendering of each submenu until just before it is initially made visible. Lastly, the effect configuration property is set to use the pre-canned FADE ContainerEffect instance bundled with the Container Core package to animate each submenu's opacity as it is shown and hidden.

Finally, it is necessary to set the "position" CSS property of the root Menu instance's element (<div id="#productsandservices">) to "static" to match that of the "position" configuration property.

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

Menu Family Examples:

More Menu Family Resources:

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings