I have a simple 2 level menu, and the upper menu should get the class "selected" if the mouse is over, and the class should be removed when moving over another first-level menu item. But thats not the problem, that already works.
My problem is: the first-level menuitem should leave on "selected" until i go on another first-level menuitem. Up to now my script removes the class "selected" as soon as i leave my mouse from the item
<script type="text/javascript">
$(document).ready(function(){
$("#navi li").hover(function(){
$(this).addClass('selected');
},function(){
$(this).removeClass('selected');
});
});
</script>
I want that all items with the class "selected" getting their class removed as soon as my mouse is on another item, but if the mouse is only on a submenu-item or whereever it could be on the page, the selected item should stay selected.