I'm having trouble applying a hover effect to a UL without affecting the UL that is a child of one list item. I've tried various methods like using the > sign and the .not() selector, but so far nothing has worked.
Below is my simplified HTML structure:
<ul id="menu">
<li class="menubox"><a href="#">Home</a></li>
<li class="menubox"><a href="#">About Us</a></li>
<li class="menubox"><a href="#" id="products">Products</a>
<ul id="menu_products">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
</ul>
</li>
<li class="menubox"><a href="#">Forum</a></li>
</ul>
Here are some relevant CSS snippets:
#menu {
position: relative;
width: 250px;
}
ul#menu{
list-style: none;
margin-left: 0;
padding-left: 0;
}
ul#menu li a{
display: block;
text-decoration: none;
height: 40px;
}
#menu_products{
list-style: none;
display: none;
margin-left: 0;
padding-left: 0;
}
ul#menu_products li a{
padding-left: 4em;
height:30px;
}
And here's the jQuery code being used:
$("ul#menu > li").hover(
function() {
$(this).stop(true, true).animate({fontSize:"1.4em"}, 150);
},
function() {
$(this).stop(true, true).animate({fontSize:"1.0em"}, 150);
});
I also attempted using the selector ("ul#menu > li").not("#menu_products"), but it didn't work as expected. Any suggestions on how to achieve the desired result?