|
Learn Java Script Today | | | Over 5000 Free Fonts | | | Tutorials | | | Javascript Forum | | | Other Javascript Resources | | | Cheat Sheet |
Since the menu is built up of plain HTML and all the style declaration is defined in the external CSS file this can be modified to create a custom look and feel of the DHTML menu. Small UpdateTo allow skins to work both the current page and the scriptlet needs to load the same css file.
I've changed the script to do this automatically but one needs to add the <link type="text/css" rel="stylesheet" href="someMenu.css" id="menuStyleSheet"> Customize the LookThe style changes are done by changing the table.menu tr td {} table.menu tr.highlight td {background: highlight; color: highlighttext;} This would result in the standard Windows 95/98 look (Some padding needs to be added as well). To get the
Office 97 look one needs mark the cells with icons with the table.menu tr td.icon {text-align: center;} table.menu tr.highlight td.icon {background: transparent; text-align: center;} table.menu tr td.icon img {border: 1px solid buttonface;} table.menu tr.highlight td.icon img {border-color: buttonhighlight buttonshadow buttonshadow buttonhighlight;} The menu bar is built up using elements with the Changing bordersDue to the fact that borders are not displayed when table cells are empty one need to add the entity
to all empty. To be able to pick out leftmost and rightmost cell in the table one need to add a class name to these
as well and since the Office 97 style uses the special class <tr class="sub" menu="someMenu"> <td class="icon"><img src="driveicon.gif"></td> <td class="middle">Save</td> <td class="more">4</td> </tr> <tr> <td class="left"> </td> <td class="middle">Exit</td> <td class="right"> </td> </tr> Below is a snippet from the SmartFTP Skin CSS file that shows how to define the rule for the left/icon table cell. table.menu tr td.icon, table.menu tr td.left {text-align: center; border: 1px solid buttonface; border-right: 0px;} table.menu tr.highlight td.icon, table.menu tr.highlight td.left {border-left: 1px solid buttonshadow; border-top: 1px solid buttonshadow; border-bottom: 1px solid buttonhighlight;} Background ImagesBackground images can be done equally easy as well using the background css property. Below is a snippet from the QNX Skin. table.menu tr td.more, table.menu tr td.right {font-family: webdings; width: 20px; text-align: right; padding: 1px;} table.menu tr.highlight td.more, table.menu tr.highlight td.right {background: url('right.gif') repeat-x center right;} Customizing the Menu BarThe menu bar is built up of elements with the class name root but it can be any type of element
and I've used a table with three cells with the class names Below is the HTML and CSS for the QNX Skin. <div id="menuBar"> <table class="menuBar" onmouseover="menuBarOver()" onmouseout="menuBarOut()" onclick="menuBarClick()" cellspacing="1" cellpadding="0"> <tr> ... <td> <table cellspacing="0" cellpadding="0" class="root" menu="skinMenu"> <tr> <td class="left"></td> <td class="middle">Skins</td> <td class="right"></td> </tr> </table> </td> </tr> </table> </div> .root .left {background: url('left.gif'); width: 7px;} .rootHighlight .left {background: url('leftHighlight.gif'); width: 7px;} .rootActive .left {background: url('leftActive.gif'); width: 7px;} .root .middle {background: url('middle.gif'); text-align: center; font-family: tahoma; font-size: 11px; height: 19px; padding: 1px;} .rootHighlight .middle {background: url('middle.gif'); text-align: center; font-family: tahoma; font-size: 11px; height: 19px; padding: 1px;} .rootActive .middle {background: url('middleActive.gif'); text-align: center; font-family: tahoma; font-size: 11px; height: 19px; padding-left: 2px; padding-top: 2px; padding-right: 0; padding-bottom: 0;} .root .right {background: url('right.gif') center right; width: 7px;} .rootHighlight .right {background: url('right.gif') center right; width: 7px;} .rootActive .right {background: url('rightActive.gif') center right; width: 7px;} That's it. This technique works with the dock bar and the popup menu as well so start creating... Creating menus
|
|