I have a menu with parent and child elements. If you hover over a parent item with children, the submenu slides down. If you hover off, it slides up. Perfect.
However, if you are ON a child page, how do I change this jquery to have that submenu open by default?
So if an item has the class "current_page_ancestor" it would be open on page load
jQuery(function($) {
$('.side-menu ul > li, ul.children > li, .side-menu ul > li, ul.sub-menu > li').hover(function () {
if ($('> ul.children, > ul.sub-menu',this).length > 0) {
$('> ul.children, > ul.sub-menu',this).stop().slideDown('slow');
}
},function () {
if ($('> ul.children, > ul.sub-menu',this).length > 0) {
$('> ul.children, > ul.sub-menu',this).stop().slideUp('slow');
}
});
});