Home
Menu and Navigation
CSS Based
Here
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE5+ Opr7+
Chrome CSS Drop Down Menu (v2.5) Author:
Updated: Oct 29th, 08 to v2.5, which adds ability to customize reveal animation speed, plus IE8 beta2 compatibility. Only .js file changed from v2.4! Description: We decided to create this script when we needed a compact CSS drop down menu for a project. Chrome Menu is a CSS and JavaScript hybrid drop down menu. It's easy to configure and search engine friendly. The main menu bar consist of a CSS list, while the drop down menus are simply regular DIV tags on page. Thanks to JavaScript, the menu supports subtle but important effects such as delay before menu disappearance, and repositioning of the menu if too close to any one of the four corners of the window. The entire menu, including images and external files, is extremely compact. Thanks to CSS, the menu can be styled with a different "theme" easily, just by modifying a few CSS attributes and changing a couple of images' colors. Some highlights of this menu:
Demo: Demo 2 (left aligned, red theme):
Demo 3 (blue theme):
Demo 4 (right aligned, green theme):
Directions: Simply download chromemenu.zip, which contains all the files that make up the menu:
Note: Also included in the zip are slightly modified versions of the above ".gif" and ".css" files that create a different theme for the menu instantly. As you can see in the source of "demo.htm", the entire mark up for the menu looks like this: <div class="chromestyle" id="chromemenu">
<ul>
<li><a href="http://www.dynamicdrive.com">Home</a></li>
<li><a href="#" rel="dropmenu1">Resources</a></li>
<li><a href="#" rel="dropmenu2">News</a></li>
</ul>
</div>
<!--1st drop down menu -->
<div id="dropmenu1" class="dropmenudiv">
<a href="http://www.dynamicdrive.com/">Dynamic Drive</a>
<a href="http://www.cssdrive.com">CSS Drive</a>
<a href="http://www.javascriptkit.com">JavaScript Kit</a>
</div>
<!--2nd drop down menu -->
<div id="dropmenu2" class="dropmenudiv" style="width: 150px;">
<a href="http://www.cnn.com/">CNN</a>
<a href="http://www.msnbc.com">MSNBC</a>
<a href="http://news.bbc.co.uk">BBC News</a>
</div>
<script type="text/javascript">
cssdropdown.startchrome("chromemenu")
</script>
The list ( The DIVs are the drop down menus you wish to be associated with the menu bar links. Each DIV should be assigned a unique ID (code in red), which is then assigned to the desired menu bar link through the "rel" attribute and by assigning as its value the ID of the drop down menu. That's it! Alternate themesJust by changing the colors of the two images used by the menu, plus adjust the CSS file accordingly, you can have a different look for your menu. For example: In the zip file you downloaded above, I've included the alternate versions of the original ".gif" and ".css" files that make up the 4 themes you see above (gray, blue, green, and red). You can easily create your own themes, just by modifying the color of the original images using any decent graphics program, by manipulating the image's Hue/Saturation properties for example. Multiple chrome menu bars on the same pageYou can easily define more than one Chrome Menu bar on a page. Simply duplicate the HTML for each menu bar instance, and at the very end of the page, initialize them all: <script type="text/javascript">
cssdropdown.startchrome("chromemenu", "chromemenu2")
</script>
Where " For Your Information
text-align: center; /*set value to "left", "center", or "right"*/
disappeardelay: 250, //set delay in
miliseconds before menu disappears onmouseout
|