Online Book Reader

Home Category

JQuery_ Novice to Ninja - Earle Castledine [58]

By Root 1149 0
requests become more elaborate), the navigation structure can grow unwieldy and become potentially confusing to our users. A well-crafted menu allows us to categorize our content structure while minimizing the valuable screen space it consumes.

Expandable/Collapsible Menus

A common feature of vertical site navigation is a submenu system, where links are grouped into similar categories. This makes it easy for the user to find relevant information and, by allowing the top-level categories to be expanded and collapsed, lets us store a large amount of information in a relatively small area. It also looks cool when menus slide open and close shut. A simple and effective expandable menu is very easy to set up; in fact, we learned most of the code required for a menu way back in Chapter 2. We’ll start by creating a simple menu, and then add a few extra features to it. Our initial menu will look like the one in Figure 5.1.

Figure 5.1. Expandable menus

These days (and until the HTML 5 navigation tag becomes standard) almost all navigational controls are created using unordered lists. From a semantic standpoint this is perfectly sensible, after all, a navigation menu is just a list of links. For our expandable menu, we’ll start off with a set of nested lists:

chapter_05/01_expandable_menus/index.html (excerpt)

Return Main Page Previous Page Next Page

®Online Book Reader