Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 7th, 2005, 04:17 PM
tihonna tihonna is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 93 tihonna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 48 m 19 sec
Reputation Power: 5
hover in main menu

I have a two level menu - I want to hover a different color - it works fine on the submenu - but on the main menu it just changes over the words. This is my example:

http://webpages.charter.net/jukoenig/alaarktest/testingindex.htm

This is the code:

Code:
<style type="text/css">

#csstopmenu, #csstopmenu ul{
padding: 0;
margin: 0;
list-style: none;
}

#csstopmenu li{
float: top;
position: relative;
width: 10em;
}

#csstopmenu li a:hover{
background-image: url(../images/ButtonOvr.jpg); 
}

#csstopmenu a{
text-decoration: none;
}

.mainitems{
border: 1px solid black;
border-left-width: 1px;
background-image: url(../images/button.jpg);  
}


.headerlinks a{
margin: auto 8px;
font-weight: bold;
color: black;
}

.submenus{ 
display: none;
width: 10em;
position: absolute;
top: 0em;
left: 10em;
border: 1px solid black;
background-image: url(../images/buttonsub.jpg);

}

.submenus li{
width: 100%;
}

.submenus li a{
display: block;
width: 100%;
font-weight: bold;
color: black;
text-indent: 3px;
}

html>body .submenus li a{ /* non IE browsers */
width: auto;
}

.submenus li a:hover{
border: 1px solid black;
border-left-width: 1px;
background-image: url(../images/ButtonOvrSub.jpg); 

}

#csstopmenu li>ul {/* non IE browsers */
top: auto;
left: auto;
}

#csstopmenu li:hover ul, li.over ul {
display: block;
}

html>body #clearmenu{ /* non IE browsers */
height: 3px;
}

</style>

<script type="text/javascript">

startMenu = function() {
if (document.all&&document.getElementById) {
cssmenu = document.getElementById("csstopmenu");
for (i=0; i<cssmenu.childNodes.length; i++) {
node = cssmenu.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function(){                  
this.className=this.className.replace(" over", "")
}
}
}
}
}

if (window.attachEvent)
window.attachEvent("onload", startMenu)
else
window.onload=startMenu;

</script>
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>

<body>
<ul id="csstopmenu">

  <li class="mainitems" style="border-left-width: 1px"> 
    <div class="headerlinks"><a href="http://www.alaarkrobotics.com">Home</a></div>
  </li>

  <li class="mainitems"> 
    <div class="headerlinks"><a href="..pages/sales.asp">Sales</a></div>
    <ul class="submenus">
      <li><a href="../pages/robotsales.asp/">Robots</a></li>
      <li><a href="../pages/inventorysearch.asp">Robot Parts</a></li>
    </ul>
  </li>

  <li class="mainitems"> 
    <div class="headerlinks"><a href="../pages/repairmotors.asp">Repair Motors</a></div>
    <ul class="submenus">
      <li><a href="../pages/wristrepair.asp">Wrist Units</a></li>
      <li><a href="../pages/robotrepair.asp">Robots</a></li>
      <li><a href="../pages/teachpendantrepair.asp">Teach Pendants</a></li>
      <li><a href="../pages/circuitboardrepair.asp">Circuit Boards</a></li>
    </ul>
  </li>
  
   
  <li class="mainitems"> 
    <div class="headerlinks"><a href="../pages/robotrecondition.asp">Robot Recondition</a></div>
  </li>
  
    
  <li class="mainitems"> 
    <div class="headerlinks"><a href="../pages/equipmentwanted.asp">Equipment 
      Wanted</a></div>
  </li>
  
    
  <li class="mainitems"> 
    <div class="headerlinks"><a href="../pages/contact.asp">Contact Us</a></div>
  </li>
  
    
  <li class="mainitems"> 
    <div class="headerlinks"><a href="../pages/map.asp">Map</a></div>
  </li>

</ul>

<div id="clearmenu" style="clear: left"><!-- TemplateBeginEditable name="Body" -->Body<!-- TemplateEndEditable --></div>


</body>
</html>

Last edited by Lafinboy : November 8th, 2005 at 09:02 PM.

Reply With Quote
  #2  
Old November 7th, 2005, 06:35 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
You'll need to apply display: block; to your top menu a items.

Please learn to use wrap your code in code or highlight tags please. Makes it much easier for us to work with your code.
Comments on this post
banker agrees: amen

Reply With Quote
  #3  
Old November 8th, 2005, 10:41 AM
tihonna tihonna is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 93 tihonna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 48 m 19 sec
Reputation Power: 5
wrap code in code

Quote:
Originally Posted by Lafinboy
You'll need to apply display: block; to your top menu a items.

Please learn to use wrap your code in code or highlight tags please. Makes it much easier for us to work with your code.


What do you mean by wrap code in code?

I'm not sure where to add the display: block; - I added it to all of the top menu items - I'm not sure what you mean by the a items?

None of the places that I put the code worked.

Last edited by tihonna : November 8th, 2005 at 10:50 AM. Reason: Add a question about the original solution

Reply With Quote
  #4  
Old November 8th, 2005, 02:04 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Quote:
Originally Posted by tihonna
What do you mean by wrap code in code?


see this thread: Instructions for new posters.

I hope this helps.
__________________
ShepherdWeb :: Charging Rhino Wizard

I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor.
{Henry David Thoreau}

§ shepherdweb.com
§ fariswheel productions
§ reagan administration

Reply With Quote
  #5  
Old November 8th, 2005, 09:08 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
Here are the two css declarations you need to change. Particular changes are highlighted for you:
Code:
#csstopmenu li a { display: block; }

.submenus{
display: none;
width: 10em;
position: absolute;
top: 0em;
left: 10em;
border: 1px solid black;
background-image: url(../images/buttonsub.jpg);
z-index: 10;
}


There are a number of problems with the menu, the main one being that hovered lists cover up the lists underneath them. While this may not be such a great problem for mouse users (they can just move the mouse away), it is a problem for keyboard users who need to tab through each of the items to get to the next item on the list.
Consider moving the sublists so they fly out to the side of the main list.

Reply With Quote
  #6  
Old November 9th, 2005, 08:30 AM
tihonna tihonna is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 93 tihonna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 48 m 19 sec
Reputation Power: 5
Hover

Quote:
Originally Posted by Lafinboy
Here are the two css declarations you need to change. Particular changes are highlighted for you:
Code:
#csstopmenu li a { display: block; }

.submenus{
display: none;
width: 10em;
position: absolute;
top: 0em;
left: 10em;
border: 1px solid black;
background-image: url(../images/buttonsub.jpg);
z-index: 10;
}


There are a number of problems with the menu, the main one being that hovered lists cover up the lists underneath them. While this may not be such a great problem for mouse users (they can just move the mouse away), it is a problem for keyboard users who need to tab through each of the items to get to the next item on the list.
Consider moving the sublists so they fly out to the side of the main list.


I added the code for the a item - I also had to add width: 100% to get it to work.

What does the z-index do?

What other problems did you mean?

Last edited by tihonna : November 9th, 2005 at 02:49 PM. Reason: added item

Reply With Quote
  #7  
Old November 18th, 2005, 09:08 AM
MARKEDAGAIN's Avatar
MARKEDAGAIN MARKEDAGAIN is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Nov 2004
Location: Montreal
Posts: 668 MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level)MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level)MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level)MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level)MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level)MARKEDAGAIN User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 6 Days 7 h 4 m 19 sec
Reputation Power: 24
Quote:
Originally Posted by tihonna

What does the z-index do?



z-index controls if a block is raised from the page, flat with the page or suken.

for example the quote box in this thread would have something like z-index:-20 , this will giv eyou a suken look.
__________________
Mark
If you found a post particularly helpful, show your appreciation by clicking the "scales" icon in the bar just above the post, at the right hand side.

Reply With Quote
  #8  
Old November 18th, 2005, 04:52 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
Quote:
Originally Posted by MARKEDAGAIN
z-index controls if a block is raised from the page, flat with the page or suken.

for example the quote box in this thread would have something like z-index:-20 , this will giv eyou a suken look.


The z-index will give you no such visual effects.

The simplest way to think of z-index is as a reference to the layers position in the stack that makes up the page. Imagine that each element on the page is drawn onto a clear piece of plastic. If all pieces are layed next to each other without overlapping then they will all have the same z-index, ie they will all be on the same layer.

Now say you want the logo piece to overlap the navigation bar. So you move one piece of plastic so it overlaps the lower piece. This increases the z-index of the logo piece, placing it above the stack of other pieces.

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > hover in main menu


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT