Ok on my website that I finally got working in the browsers.
I want to add a sublink area under the banner in the greenish color bar. So if someone hovers over the main navigation buttons and it has sublinks they will show here.
http://www.clandesti...rance/index.php
How hard would this be to achieve?
I've seen tutorials about the vertical subnav menu, but what about horizontal?
Thanks a bunch!
best way to go about making this sublink navigation?
Started by
Clandestine
, Oct 29 2008 01:53 AM
3 replies to this topic
#1
Posted 29 October 2008 - 01:53 AM
#2
Posted 29 October 2008 - 10:52 AM
The way I'd do this would be with a bit of Javascript. Add this to the Head of you page.
<script language="javascript" type="text/javascript"> <!-- function showorhide(id) { if (document.getElementById(id).style.display == "none") { document.getElementById(id).style.display = "block"; } else { document.getElementById(id).style.display = "none"; } } --> </script>Then on your links you could have:
<a href="#" onclick="showorhide('subnav1'); ">Link 1</a> <a href="#" onclick="showorhide('subnav2'); ">Link 2</a> <a href="#" onclick="showorhide('subnav3'); ">Link 3</a>Where you have:
<div id="subnav1" style="display:none; ">Sub navigation links</div> <div id="subnav2" style="display:none; ">Sub navigation links</div> <div id="subnav3" style="display:none; ">Sub navigation links</div>That should do the trick for you
#3
Posted 29 October 2008 - 11:32 AM
Thanks, this is what I wanted, but the sublinks don't clear when I click a different link. They just add up.
I uploaded the site so you can see what I am talking about
Thanks!!
I uploaded the site so you can see what I am talking about
Thanks!!
Edited by Clandestine, 29 October 2008 - 12:23 PM.
#4
Posted 02 November 2008 - 08:03 PM
In the showorhide() function, you need to hide the previously opened submenu. The easiest way to do this is either a variable that keeps track of the last opened one, or a loop that will go through every submenu until it finds the open one and hides it (easiest way to get a list of all the submenus is to make a container div to group them all together).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users