|
||
| Inside Technique : WebFX DHTML Demos : DHTML Menus In this demonstration, we show you how to create HTML-based menubars that have the same look like standard window menus but support HTML, swipe or dissolve animations, the ability to undock the menus and redock them to the top or bottom of your screen. Before we discuss how to create and customize your own menus, try out a menu demonstration. When the page loads, you will find an extra menubar below your standard browser menu. Try expanding menu choices and undocking the menu. Once you are finished, click on the link, "DHTML Demo" to return to this page. Creating the MenubarThe menu is created as a set of nested table similar to the InsideDHTML Menu Toolkit. The table is converted into a menubar using a specially
designed stylesheet. All you need to do is define your table as follows as include the stylesheet and appropriate scripts (available at the end of this page), and you will have a fully functional DHTML menu:
The The menusOnce you create your menubar, Now you need to create each menu choice. All menus are tables with
<td class="root">Demo
<table cellspacing="0" class="menu" style="visibility: hidden;">
<tr href="http://put.your.link.here">
<td><!-- Put your image icon here --></td>
<td nowrap>This is your first menu item</td>
<td><!-- This is here to create space for the arrow for subs -->
</td>
</tr>
</table>
</td>
The To force the specified The Sub-MenusTo create a submenu you create a menu item (
<tr class="sub">
<td nowrap>The sub opener</td>
<td><span class="more">4</span>
<table class="menu" style="visibility: hidden" cellspacing=0>
<tr>
<td>This is a sub</td>
</tr>
</table>
If you want to use the arrow that indicates the sub you should include the DockingIf you don't want a moveable menubar you can just remove the handle from the menubar. If you wan't a moveable menubar, you need to do one additional step. Enclose your content within a div called outerDiv and add a call to the fixSize() function directly after the the table that defines your menu. Include this directly after your closing table tag: <div id="outerDiv"> <script language="Javascript"> fixSize(); </script> Following the script, you include your body content. After your content, include a closing div directly immediately before the end of the body ( Gluing it all togetherThe best way to see how you get everything to work is to see the source code for one of the sample pages. The side image that is used in the menu is added by an extra column (TD) in front of the others that has colspan=99 (some value bigger than or equal than the number of menui tems in the menu. It is associated with a stylesheet that creates the grab handle. StylingI've made three different versions of this menu (All demos require IE4).
Note that the animation has been moved to seperate files for ease of use. For the menu to work you need only the menu.js file but if you want any of the animations you need to include on as well. If you include both the fade verion has higher priority Page 1:WebFX DHTML Demos © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |