In order for the main <li> to preserve the style when hovering secondary links, you need to apply the style :hover to <li> , and not to <a> inside it.
Js
$("#nav-menu > li").hover( function(){ $(this).addClass("hover"); }, function(){ $(this).removeClass("hover"); } )
CSS
#nav-menu li:hover, #nav-menu li.hover {}
Remember to neutralize the #nav-menu li:hover styles for secondary <li> elements. You can use #nav-menu > li:hover , I think, but browser support is not so strong.
source share