I've currently got your basic, run-of-the-mill menu tree as follows:
<ul id="nav">
<li>
<a href="#">home</a>
<div class="controls">Some controls go here</div>
<ul>
<li>
<a href="#">item 1</a>
<div class="controls">Some controls go here</div>
</li>
<li>
<a href="#">item 2</a>
<div class="controls">Some controls go here</div>
</li>
</ul>
</li>
</ul>
The divs with the "controls" class are hidden to start with. What I want to happen is that when you hover over an li, the controls for that respective li show (when you move your mouse away, they hide again). The problem occurs when you hover over one of the nested li's, it display's it's parents controls as well. Here is the jQuery I'm using:
$("#nav li").hover(
function() {
$(".controls:first", this).css("display", "block");
},
function() {
$(".controls:first", this).css("display", "none");
}
);
Thanks for your help.
Remy
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…