JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrapper">
<div id="navBar">
<ul id="navigation">
<li>
<a class="head" href="?p=1">About SfT</a>
<ul>
<li><a href="?p=1.1">sub1</a></li>
<li><a href="?p=1.2">sub2</a></li>
<li><a href="?p=1.3">sub3</a></li>
<li><a href="?p=1.4.1">sub4</a></li>
<li><a href="?p=1.4.2">sub4.1</a></li>
<li><a href="?p=1.4.3">sub4.2</a></li>
<li><a href="?p=1.4.4">sub4.3</a></li>
<li><a href="?p=1.5">sub5</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.2">Your Life</a>
<ul>
<li><a href="?p=1.2.1">sub1</a></li>
<li><a href="?p=1.2.2">sub2</a></li>
<li><a href="?p=1.2.3">sub3</a></li>
<li><a href="?p=1.2.4">sub4</a></li>
<li><a href="?p=1.2.5">sub5</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.3">Your Health</a>
<ul>
<li><a href="?p=accordionTest2.html">sub1</a></li>
<li><a href="?p=1.3.3">sub2</a></li>
<li><a href="?p=1.3.4">sub3</a></li>
<li><a href="?p=1.3.5">sub4</a></li>
<li><a href="?p=1.3.6">sub5</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.3">Your Call</a>
<ul>
<li><a href="?p=1.4.1">sub1</a></li>
<li><a href="?p=1.4.2">sub2</a></li>
<li><a href="?p=1.4.3">sub3</a></li>
...
CSS
* { margin: 0; padding: 0; }
body { margin: 0; padding: 0; font-size: small; color: #333 }
#wrapper {
width:600px;
margin:0 auto;
padding-top:100px;
}
#navBar {
height:380px;
margin-bottom:1em;
}
#navigation {
margin:0px;
padding:0px;
text-indent:0px;
/*background-color:#EFEFEF; sublists background color */
width:200px;
}
#navigation a.head { /* list header */
height: 40px;
cursor:pointer;
background: url(collapsed.gif) no-repeat scroll 3px 4px; /* list header bg color and img settings */
color:#999;
display:block;
font-weight:bold;
font-size: 22px;
margin:0px;
padding:0px;
text-indent:20px;
text-decoration: none;
}
#navigation a.head:hover {
color:#900;
}
#navigation a.selected {
background-image: url(expanded.gif);
color:#900;
}
#navigation a.current {
color: #F60;;
font-weight:bold;
}
#navigation ul {
margin:0px;
padding:0px;
text-indent:0px;
}
#navigation li {
list-style:none outside none;
/*display:inline;*/
padding:5px 0 5px 0;
}
#navigation li li a {
color:#000000;
display:block;
font-size:16px;
text-indent:20px;
text-decoration: none;
}
#navigation li li a:hover { /* sublist hover state bg and color */
color:#F60;;
font-weight:bold;
}
JavaScript
// simple accordion with mouseover event
jQuery('#navigation').accordion({
active: false,
header: '.head',
navigation: true,
event: 'mouseover',
fillSpace: true,
animated: 'easeslide',
collapsible: true
});
$('#navigation').mouseleave(function(){
$( "#navigation" ).accordion({ active: false});
});