PDA

View Full Version : Floating Horizontal Spry Menu Bar


jeant
05-05-2012, 05:46 PM
I have Horizontal Spry Menu Bar created in DW that I have used for a year with no problem. In an effort to change one thing (successfully) now the bar floats over the page as you scroll to the bottom. How do I make it fixed?

My code:

/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
{
margin-left:150px;
padding: -1.0em;
list-style-type: none;
font-size: 75%;
cursor: default;
width: auto;
position: fixed; center: -40;

}
/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
ul.MenuBarActive
{
z-index: 1000;
}
/* Menu item containers, position children relative to this container and are a fixed width */
ul.MenuBarHorizontal li
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 86%;
position: relative;
text-align: center;
cursor: pointer;
width: 9em;
float: left;
white-space: no wrap;

}
/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
ul.MenuBarHorizontal ul
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 85%;
z-index: 1020;
cursor: default;
width: 7em;
position: absolute;
left: -1000em;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
{
left: auto;
}
/* Menu item containers are same fixed width as parent */
ul.MenuBarHorizontal ul li
{
width: 7.2em;
}
/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
ul.MenuBarHorizontal ul ul
{
position: absolute;
margin: -5% 0 0 95%;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
{
left: auto;
top: 0;
}

/************************************************** *****************************

DESIGN INFORMATION: describes color scheme, borders, fonts

************************************************** *****************************/

/* Submenu containers have borders on all sides */
ul.MenuBarHorizontal ul
{
border: 1px solid #FFFFCC;
}
/* Menu items are a light gray block with padding and no text decoration */
ul.MenuBarHorizontal a
{
display: block;
cursor: pointer;
background-color: #D92657;
padding: 0.5em 0.5em;
color: #FFFFCC;
text-decoration: none;
}
/* Menu items that have mouse over or focus have a blue background and white text */
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
{
background-color: #D92657;
color: #FFFFCC;
}
/* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
{
background-color: #D92657;
color: #FFFFCC;
}

gentleone
05-06-2012, 12:34 PM
In your first CSS selector, .ulMenuBarHorizontal, delete these:

position: fixed; center: -40;

Or you need to change 'fixed' to 'relative'... I'm not sure, because it has been ages since I've used Spry.

In any case the position fixed causes your 'floating' issue and 'center: -40' is rubbish, because there is no 'center' CSS property. Also negative paddings, which you have in .ulMenuBarHorizontal as well, are not allowed and it doesn't make sense either.