In this menu the sub categories slide down. I used CSS to keep the sub menu open when on the main categorys page, but the jQuery slideUp() function disables that on mouseOut. I would like to keep the sub-menu always open when on the main categories page.
<div id="sidebar">
<ul>
<li class="main">
<a href="real_estate.php" class="real_estate">Real Estate </a>
<ul class="sub" id="sub_real_estate">
<li> <a href="consulting.php">Consulting Services</a></li>
<li> <a href="investment.php">Investment</a></li>
<li> <a href="property_mgmt.php">Property Management</a></li>
<li> <a href="development.php">Development</a></li>
</ul>
</li>
<li class="main">
<a href="investment.php" class="">Investment</a>
<ul class="sub" id="sub_investment">
<li><a href="philosophy.php">Philosophy</a></li>
<li><a href="criteria.php">Criteria</a></li>
</ul>
</li>
</ul>
</div>
Jquery
$(document).ready(function() {
$(".main").hover(function() {
$(".sub", this).slideDown('slow');
},
function() {
$(".sub", this).slideUp('slow');
});
})
CSS
.sub {display:none;}
body.real_estate #sub_real_estate, body.investment #sub_investment {
display:block;
}
Try this:
Simply
alert(window.location.href);to see what your main-categories page href is, and swap that value into the comparison I provided above.