HTML/Javascript Dropdown Help

Status
Not open for further replies.

AkiriXx

Seniorius Lurkius
23
So I have run into a small problem. I made a simple web page some time ago using dropdowns ( reference: http://htmldog.com/articles/suckerfish/dropdowns/ ) in HTML/CSS. What I want to do is instead of hovering over the li to go to the next dropdown, is to make it so you have to click it, then it scrolls down to the next menu. Key thing is, I want the menu to stay expanded until I click elsewhere, outside of that menu. I do not know enough javascript to be able to make this happen...Can someone assist?

A sample of the code:

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

body {
	margin: 0; padding: 0;
	font: 11px normal Arial, Helvetica, sans-serif;
	background: #ddd url() repeat-x;
}

#container {
	width: 960px;
	margin: 0 auto;
	position: relative;
}

p {
	background: url() center no-repeat;
	margin: 1em 2em;
}

p#smurf {
	background: transparent;
	font-style: italic;
	text-align: center;
	font-weight: bold;
	color: #7C6240;
}

#smurf strong {
	font-size: 1.2em;
	color: black;
}

h1 {
	height: 108px;
	background: url() bottom center no-repeat;
	text-indent: -999em;
	margin: 1em 0 0 0;
}

#nav, #nav ul {
	float: left;
	width: 100%;                  /*This changes the entire width of the bar*/
	list-style: none;
	line-height: 1;
	background: white;
	font-weight: bold;
	padding: 0;
	border: solid black;
	border-width: 1px 0;
	margin: 0 0 1em 0;
}

#nav a {
	display: block;
	width: 10em;
	w\idth: 16em;
	color: #000;
	text-decoration: none;
	padding: 0.25em 2em;
}

#nav a.daddy {
	background: url(/html//civis/threads/html-javascript-dropdown-help.1134325/post-21236639/rightarrow2.gif) center right no-repeat;
}

#nav li {
	float: left;
	padding: 0;
	width: 12em;
}

#nav li ul {
	color: red;
	position: absolute;
	left: -999em;
	height: auto;
	width: 14.4em;
	width: 14em;
	font-weight: bold;
	border-width: 1px;
	margin: 0;
}

#nav li li {
	padding-right: 1em;
	width: 13em
}

#nav li ul a {
	width: 13em;
	w\idth: 9em;
}

#nav li ul ul {
	margin: -1.6em 0 0 14em;
}

#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul, #nav li.sfhover ul ul ul ul {
	left: -999em;
}

#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li  li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul, #nav li li li li.sfhover ul {
	left: auto;
}

#nav li:hover, #nav li.sfhover {
	background: #99CCFF;
}

#content {
	clear: left;
}

#content a {
	color: black;
}

#content a:hover {
	text-decoration: none;
}

a:link {
	color: black;
	text-decoration: underline;
	font-weight: bold;
}
 
a:visited {
	color: black;
	text-decoration: underline;
	font-weight: bold;
}
 
A:hover {text-decoration: none; color: #00FFFF;}

a:hover {text-decoration: underline; color: red;}


.header { color: red; cursor: hand; cursor:pointer; text-decoration: underline;}
.details { display:none; visibility:hidden; }

</style>

HTML
Code:
<ul id="nav">
<li><a href="#">Percoidei</a>
     <ul>         <li><a href="#">Remoras</a>
             <ul>                 <li><a href="#">Echeneis</a></li>
                 <li><a href="#">Phtheirichthys</a></li>
                 <li><a href="#">Remora</a></li>
                 <li><a href="#">Remorina</a></li>
                 <li><a href="#">Rhombochirus</a></li>
             </ul>
         </li>
         <li><a href="#">Tilefishes</a></li>
         <li><a href="#">Bluefishes</a></li>
         <li><a href="#">Tigerfishes</a></li>
     </ul>
 </li>
 <li><a href="#">Anabantoidei</a>
     <!-- etc. --> </li>
 <!-- etc. --> </ul>
 
Status
Not open for further replies.