Let me describe the problem in details:
I want to show an absolute positioned div when hovering over an element. That's really simple with jQuery and works just fine. But when the mouse goes over one of the child elements, it triggers the mouseout event of the containing div. How do I keep javascript from triggering the mouseout event of the containing element when hovering a child element.
What's the best and shortest way to do that with jQuery?
Here is a simplified example to illustrate what I mean:
Html:
<a>Hover Me</a>
<div>
<input>Test</input>
<select>
<option>Option 1</option>
<option>Option 2</option>
</select>
</div>
Javascript/jQuery:
$('a').hover( function() { $(this).next().show() }
function() { $(this).next().hide() } );
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…