The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To Only Modify Top Level Menu Items, how to modify only top level horizontal Spry menu bar items background
hjl1999
post Aug 19 2009, 12:36 PM
Post #1


Newbie
*

Group: Members
Posts: 18
Joined: 19-August 09
Member No.: 9,488



We wish just to changes the top level Menu Bar item width and background color.
We do NOT want to make any changes to the 2nd or 3rd level menu. Can you please tell us how to do this?

The horizontal Menu Bar test file is:
http://www.angelfire.com/pro/hollywoodhouse/test-menu.html

We saved the html file in text.
http://www.angelfire.com/pro/hollywoodhouse/test-menu.txt

Thank you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hjl1999
post Aug 19 2009, 12:39 PM
Post #2


Newbie
*

Group: Members
Posts: 18
Joined: 19-August 09
Member No.: 9,488



This is actually standard Dreamweaver CS3 standard Spry Menu Bar function call.
Now this is my code, as follows; in additional to SpryAssets/SpryMenuBar.js

I have modified the code, and the result is:
Top parent level width change as programmed. Hover over background do change. But please tell me how to change Non-hover background color change?

Submenu hover over background color change differently item 1 and item 3 are different with item 2 and item 3.
Submenu non-hover over background color do change correctly as programmed.

Can you please tell me how just to modify top level menu bar item background color, at non-hover time?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- saved from url=(0014)about:internet -->

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>horizontal menu - Dreamweaver debug</title>



<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<style type="text/css">

/* SpryMenuBarHorizontal.css - Revision: Spry Preview Release 1.4 */

/* Copyright © 2006. Adobe Systems Incorporated. All rights reserved. */

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

LAYOUT INFORMATION: describes box model, positioning, z-order

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

/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
cursor: default;
width: auto;
}
/* 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: 100%;
position: relative;
text-align: left;
cursor: pointer;
width: 8.8em;
float: left;
}
/* 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: 100%;
z-index: 1020;
cursor: default;
width: 8.6em;
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: 8.6em;
}
/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
ul.MenuBarHorizontal ul ul
{
position: absolute;
margin: 1% 0 0 98%;
}
/* 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 #CCC;
}
/* Menu items are a light gray block with padding and no text decoration */
ul.MenuBarHorizontal a
{
display: block;
cursor: pointer;
background-color: #EEE;
padding: 0.4em 0.4em;
color: #000;
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: #00FF66;
color: #FFF;
}
/* 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: #000099;
color: #FFF;
}
ul.MenuBarHorizontal li{width: 12em;} /*use this to adjust parent toplevel menu styling, add required Background color and font-size width etc - change to YOUR requirements */

ul.MenuBarHorizontal li li a {background-color: #0f0;} /* use this to set background colour of all sublevels - change to YOUR requirements*/

ul.MenuBarHorizontal li a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal li a.MenuBarSubmenuVisible{background-color: #f00; color: #000; } /* sets PARENT TOPLEVEL ONLY WHEN HOVERED OVER background colour, text colour etc - change to YOUR requirements */

ul.MenuBarHorizontal li li a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal li li a.MenuBarSubmenuVisible {background-color: #0ff; color: #fff; font-size: 13px; width: auto;} /*To prevent all sublevels, adopting PARENT TOPLEVEL css styling WHEN HOVERED OVER, this sets them back to original colour #009 font size and width etc - change to YOUR requirements*/
/*******************************************************************************

SUBMENU INDICATION: styles if there is a submenu under a given menu item

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

/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenu
{
background-image: url(SpryAssets/SpryMenuBarDown.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
{
background-image: url(SpryAssets/SpryMenuBarRight.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
{
background-image: url(SpryAssets/SpryMenuBarDownHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
{
background-image: url(SpryAssets/SpryMenuBarRightHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}

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

BROWSER HACKS: the hacks below should not be changed unless you are an expert

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

/* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
ul.MenuBarHorizontal iframe
{
position: absolute;
z-index: 1010;
}
/* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
@media screen, projection
{
ul.MenuBarHorizontal li.MenuBarItemIE
{
display: inline;
f\loat: left;
background: #FFF;
}
}

</style>

</head>

<body style="width:85%; margin-left:auto; margin-right:auto">

<img src="http://l.yimg.com/a/i/ww/beta/y3.gif" width="232" height="44" />

<div style="position: absolute; width: auto; height: auto; left: 35%; top: 3%; font-size:small; font-family: Arial, Helvetica, sans-serif;" >
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a class="MenuBarItemSubmenu" href="http://www.google.com/">Products</a>
<ul>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 1.1</a>
<ul>
<li><a href="http://www.google.com/">Item 1.1.1</a></li>
</ul>
</li>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 1.2</a>
<ul>
<li><a href="http://www.google.com/">Item 1.2.1</a></li>
</ul>
</li>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 1.3</a>
<ul>
<li><a href="http://www.google.com/">Item 1.3.1</a></li>
<li><a href="http://www.google.com/">Item 1.3.2</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.google.com/">Manufacturing</a>
<ul>
<li><a href="http://www.google.com/">Item 2.1</a></li>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 2.2</a>
<ul>
<li><a href="http://www.google.com/">Item 2.2.1</a></li>
</ul>
</li>
<li><a href="http://www.google.com/">Item 2.3</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.google.com/">Services</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="http://www.google.com/">Item 3.1</a>
<ul>
<li><a href="http://www.google.com/">Item 3.1.1</a></li>
<li><a href="http://www.google.com/">Item 3.1.2</a></li>
</ul>
</li>
<li><a href="http://www.google.com/">Item 3.2</a></li>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 3.3</a>
<ul>
<li><a href="http://www.google.com/">Item 3.3.1</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.google.com/">Company</a>
<ul>
<li><a href="http://www.google.com/" class="MenuBarItemSubmenu">Item 4.1</a>
<ul>
<li><a href="http://www.google.com/">Item 4.1.1</a></li>
</ul>
</li>
<li><a href="http://www.google.com/">Item 4.2</a></li>
<li><a href="http://www.google.com/">Item 4.3</a></li>
</ul>
</li>
</ul>
</div>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Debug Dreamwaver Spry Menu Bar - Horizontal.</p>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>

</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hjl1999
post Aug 20 2009, 02:09 PM
Post #3


Newbie
*

Group: Members
Posts: 18
Joined: 19-August 09
Member No.: 9,488



Is this the correct area to ask this questions?
Or, should this be in some other areas, such as html or CCS?
Thank you very much.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hjl1999
post Aug 24 2009, 03:15 PM
Post #4


Newbie
*

Group: Members
Posts: 18
Joined: 19-August 09
Member No.: 9,488



This question "how to change horizontal drop down menu top level item mouse hover and non-hover background color and item width?"

We purposely wrote this question to be NON-editor specific. Is this proper forum to ask this question? Thank you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 24 2009, 05:09 PM
Post #5


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(hjl1999 @ Aug 19 2009, 07:39 PM) *

Can you please tell me how just to modify top level menu bar item background color, at non-hover time?


Try to give the the concerned LIs a class.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hjl1999
post Aug 31 2009, 11:17 PM
Post #6


Newbie
*

Group: Members
Posts: 18
Joined: 19-August 09
Member No.: 9,488



Thank you for your response.
OK. I have tried to modify this, but no change in the results on background color and font-size.

ul.MenuBarHorizontal li
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
position: relative;
text-align: left;
cursor: pointer;
width: 8.8em;
float: left;
}
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Micky45
post Nov 14 2011, 08:47 AM
Post #7





Group: Members
Posts: 1
Joined: 14-November 11
Member No.: 15,854



Hi,

I've been struggling with the same issue and I've managed to resolve it as follows :

Add to SpryMenuBarHorizontal.css the following:

/* This changes the top menu when the mouse hovers over it */
ul.MenuBarHorizontal a:MenuBarItemSubMenu:hover
{
background-image: url(../HoverImage.gif);
background-repeat : no-repeat;
text-align:center;
width: 100px;
}
/*--------- */

Note: Replace the "HoverImage.gif" with the image you require or replace the "background-image" property with "background-color" and "color" if you just want to change the text color.

In the html page the normal arrangement for the menu's with one level dropped down is :-

<li> <a class="MenuBarItemSubMenu" href="#">TopText
<ul>
<li> <a href="JumpTo.html">JumpToPage</a> </li>
</ul>
</li>

If you have no levels to drop down on this menu item, instead of the above five lines just add the following line:

<li> <a class="MenuBarItemSubMenu" href="TopJumpTo.html">TopText</a></li>

Replace "TopJumpTo.html" with the page you wish to jump to.

Hope this helps
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 10:58 PM