homepage Welcome to WebmasterWorld Guest from 54.227.222.235
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
Change only top level menu bar items? - Dreamweaver Spry Menu
Menu Bar Horizontal top level item change
hjl1999




msg:3975089
 5:07 pm on Aug 19, 2009 (gmt 0)

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?

Thank you.

[edited by: incrediBILL at 5:22 pm (utc) on Aug. 19, 2009]
[edit reason] removed URLs, see TOS #13 [webmasterworld.com...] [/edit]

 

hjl1999




msg:3975090
 5:09 pm on Aug 19, 2009 (gmt 0)

This is standard Dreamweaver CS3 Spry Menu Bar function call. The standard script call is SpryAssets/SpryMenuBar.js

I do some modification here, but problem results are:
Top parent level width change as programmed. Hover over background do change. But do not know how to change Non-hover top level item 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.

Now this is my code, as follows:
<!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: */
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.example.com/">Products</a>
<ul>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 1.1</a>
<ul>
<li><a href="http://www.example.com/">Item 1.1.1</a></li>
</ul>
</li>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 1.2</a>
<ul>
<li><a href="http://www.example.com/">Item 1.2.1</a></li>
</ul>
</li>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 1.3</a>
<ul>
<li><a href="http://www.example.com/">Item 1.3.1</a></li>
<li><a href="http://www.example.com/">Item 1.3.2</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.example.com/">Manufacturing</a>
<ul>
<li><a href="http://www.example.com/">Item 2.1</a></li>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 2.2</a>
<ul>
<li><a href="http://www.example.com/">Item 2.2.1</a></li>
</ul>
</li>
<li><a href="http://www.example.com/">Item 2.3</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.example.com/">Services</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="http://www.example.com/">Item 3.1</a>
<ul>
<li><a href="http://www.example.com/">Item 3.1.1</a></li>
<li><a href="http://www.example.com/">Item 3.1.2</a></li>
</ul>
</li>
<li><a href="http://www.example.com/">Item 3.2</a></li>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 3.3</a>
<ul>
<li><a href="http://www.example.com/">Item 3.3.1</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="http://www.example.com/">Company</a>
<ul>
<li><a href="http://www.example.com/" class="MenuBarItemSubmenu">Item 4.1</a>
<ul>
<li><a href="http://www.example.com/">Item 4.1.1</a></li>
</ul>
</li>
<li><a href="http://www.example.com/">Item 4.2</a></li>
<li><a href="http://www.example.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>

[edited by: incrediBILL at 5:24 pm (utc) on Aug. 19, 2009]
[edit reason] removed URLs, see TOS #13 [webmasterworld.com...] [/edit]

hjl1999




msg:3975905
 7:08 pm on Aug 20, 2009 (gmt 0)

Is this the proper area to ask this question?
Or, should this be in Html or CCS or some other area?
Thank you for your advices?

tedster




msg:3975912
 7:19 pm on Aug 20, 2009 (gmt 0)

It's the proper area, but that's a lot of code for someone to wade through for free. Can you reduce things to the more important parts?

hjl1999




msg:3976866
 4:11 pm on Aug 22, 2009 (gmt 0)

Thank you for your suggestion.

Well, I do not really understand how the CCS controls the drop down menu item size, background at mouse hover and non-hover time. So, I do not really know how to reduce the size of this code or pick the right part to list.

Thank you anyway.

Marcia




msg:3976878
 4:58 pm on Aug 22, 2009 (gmt 0)

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?

That's all that was asked - with no mention of any specific software. Unless I missed something, maybe? If the above is for some specific software, platform or structure, I don't have a clue, but...

For the benefit of those (like myself) who have no idea what the platform or software is, here's a simple, generic answer for changes to a top level menu bar:

Simply remove the code that's no longer wanted (I assume it's some kind of template) and use a PHP include instead, to change and replace the top-level menu bar. I do it all the time on sites, by modifying only one simple text file.

I often do my top (1st) level menu in the top navigation bar, with 2nd (sometimes even 3rd level with nested lists using CSS) level navigation in the left hand column, section by section. Like this:

Top level menu bar: Fruit :: Vegetables :: Grains

Left side 2nd level menu for Fruit section: apples, oranges, grapes, etc.
Left side 2nd level menu for Vegetable section: lettuce, tomatoes, onions, etc.
Left side 2nd level menu for Grains section: cake, bread, cookies, etc.

That way, not only is it user-friendly navigation using a pyramid structure (with topic-specific funneling), but all the navigation on any site is easily and quickly modifiable.

Added:
If it's a drop-down menu, how is it coded? HTML, CSS, JS, DHTML?

hjl1999




msg:3976908
 5:50 pm on Aug 22, 2009 (gmt 0)

Thank you for your responses.

These are Dreamweaver CS3 html code, when you insert "Spry Menu Bar", select "horizontal", then, these functions are automatically generated:
SpryAssets folder
SpryMenuBar.js
SpryMenuBarHorizontal.css

All we did was to merger the SpryMenuBarhorizontal.css into the header so that we can do the debugging when we modify the ccs changes of background color, font size and cell width.

hjl1999




msg:3977924
 8:11 pm on Aug 24, 2009 (gmt 0)

Well, this post has been moved to Text Code Editors.
I guess the forum administrator do this themselves.
But I do not agree this question should be relocated here:
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.

Leosghost




msg:3977984
 9:55 pm on Aug 24, 2009 (gmt 0)

and this text code editors forum is non editor specific ( although your request for help does specify that you are using dreamweaver :) ..

BTW .you want help here ? then dont publically "knock" the admins or the mods or the replies ..no one who helps here gets paid ..

You could get this fixed in a heartbeat for money ..you purposely wrote this question to get a free answer ( else you'd have paid a coder experienced in dweaver ) ..( problem with wysiwyg editors is they are convenient ..but unless you understand what they are doing under the hood you get stuck ..and need help ) ..in just about the only place on the net where you can get qualified experienced help for free ..

be nice ..dont "clippetty clop" :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved