I admire all this effort to convert menus to menus because I hate trying to crack CSS. It just seems to me that I am interfering in forces that I can never understand! I think it is much easier to add the menu files available in the jquery ui menu bar .
I downloaded the full jquery ui css file from the jquery ui download site
At the beginning of my document, I put the jquery ui css file containing everything (currently I'm on version 1.9.x), followed by a specific CSS file for the menu widget loaded from the jquery ui text branch
<link type="text/css" href="css/jquery-ui.css" rel="stylesheet" /> <link type="text/css" href="css/jquery.ui.menubar.css" rel="stylesheet" />
Do not forget that the folder with the images with all the small icons used by the jQuery user interface must be in the same folder as the jquery-ui.css file.
Then at the end of the body I have:
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.9.0.custom.min.js"></script> <script type="text/javascript" src="js/menubar/jquery.ui.menubar.js"></script>
This is a copy of the updated jQuery version, followed by a copy of the jQuery user interface file, then a menu module downloaded from the jquery ui text branch
The CSS text file is updated short:
.ui-menubar { list-style: none; margin: 0; padding-left: 0; } .ui-menubar-item { float: left; } .ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; } .ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; } .ui-menubar .ui-menu { width: 200px; position: absolute; z-index: 9999; font-weight: normal; }
but the JavaScript menu file - 328 lines - is too long to quote here. With it, you can simply call menubar (), as in this example:
$("#menu").menubar({ autoExpand: true, menuIcon: true, buttons: true, select: select });
As I said, I admire all attempts to hack into a menu object to turn it into a horizontal bar, but I found that all of them lack the standard function of the horizontal menu bar. I'm not sure why this widget is not yet associated with the jQuery user interface, but apparently there are still some errors to smooth out. For example, I tried it in IE 7 Quirks Mode, and the positioning was weird, but it looks great in Firefox, Safari, and IE 8+.