--------------- Copyright 2007 - http://www.thecredence.com, Feel free to use the code though a link back to the site is always appreciated :) This is text version of the article http://www.thecredence.com/create-drop-down-menu-using-yui-yahoo-user-interface-library/ --------------- --------------- The Web is evolving. It is not how it was few years back. Gone are those days when websites meant a set of static pages that had white background, one-two images. Now people want desktop experience in their browser; and what is a desktop with out a menubar with drop-down menus. Drop down menu can be implemented in many ways. But instead of hand coding from scratch, we will use YUI or Yahoo User Interface Library. It is a new yet one the best JS library out there. Perquisites and installation Download YUI from here, decompress and put it in an appropriate directory that is accessible from your site. YUI is divided into packages such DOM, menu etc. Some packages depends on other packages. Our menu package depends on Event, DOM and Container. We will have to include them too. The Beginning First we will include the important files. These files include three CSS files that is used to style the menu and container files for each package. You can also change the look and feel of the menu by modifying the css. Now let’s build up the markup. The markup for the menu will be an unordered list. That is the “ul” tag. Lets look at the code.
This may seem very complex. But its not actually. The menu will be held in a container div that will have id “test” and class “yuimenu”. This class tells this is a menu. Now another container div called “bd”. The start of menu will be the