JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="nav">
<li id="home"><a href="index.html">Home</a></li>
<li id="transport"><a href="#">Transportation</a>
<ul>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
</ul></li>
<li id="landdev"><a href="#">Land Development</a>
<ul>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
</ul></li>
<li id="environment"><a href="#">Environment</a>
<ul>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
<li><a href="#">text</a></li>
</ul></li>
<li id="aboutus"><a href="#">About Us</a></li>
<li id="initiative"><a href="#">Initiative</a></li>
</ul>
CSS
#nav {
width:977px;
text-indent:-222em;
background-color:#000;
margin-left:58px;
margin-top:4px;
float: left;
position: relative;
}
#nav li {
display:inline;
}
#nav li a {
float:left;
height:54px;
display:block;
}
#nav #home a {
background:url(images/nav_home_off.png) bottom left no-repeat;
width:107px;
}
#nav #home a:hover {
background:url(images/nav_home_on.png) bottom left no-repeat;
}
#nav #transport a {
background:url(images/nav_transport_off.png) bottom left no-repeat;
width:168px;
}
#nav #transport a:hover {
background:url(images/nav_transport_on.png) bottom left no-repeat;
}
#nav #landdev a {
background:url(images/nav_landdev_off.png) bottom left no-repeat;
width:194px;
}
#nav #landdev a:hover {
background:url(images/nav_landdev_on.png) bottom left no-repeat;
}
#nav #environment a {
background:url(images/nav_environment_off.png) bottom left no-repeat;
width:145px;
}
#nav #environment a:hover {
background:url(images/nav_environment_on.png) bottom left no-repeat;
}
#nav #aboutus a {
background:url(images/nav_aboutus_off.png) bottom left no-repeat;
width:229px;
}
#nav #aboutus a:hover {
background:url(images/nav_aboutus_on.png) bottom left no-repeat;
}
#nav #init a {
background:url(images/nav_abcinit_off.png) bottom left no-repeat;
width:134px;
}
#nav #init a:hover {
background:url(images/nav_abcinit_on.png) bottom left no-repeat;
}
#nav ul {
position: absolute;
visibility: hidden;
top:100%;
text-indent:0;
}
#nav #transport ul {
background-color:#f5e571;
width:168px;
left:107px;
}
#nav #landdev ul {
background-color:#fda881;
width:194px;
left:274px;
}
#nav #environment ul {
background-color:#b6e477;
width:145px;
left:469px;
}
#nav li:hover > ul {
visibility: visible;
}
#nav ul a, #nav ul a:hover {
background-image:none !important;
font-size:12px;
...
JavaScript
var colors = {
"home":"#43b1cc",
"transport":"#f6e572",
"landdev":"#fda882",
"environment":"#b6e578"
};
$('#nav > li').hover(function() {
var color = colors[$(this).attr("id")];
if(color) $(this).parent().css('background-color', color);
}, function(){
$(this).parent().css('background-color', '#000');
});
$('#nav #transport ul').hover(function() {
$(this).prev('a').css('backgroundImage', 'url(images/nav_transport_on.png)');
}, function(){
$(this).prev('a').css('backgroundImage', 'url(images/nav_transport_off.png)');
});