jquery LI's anchor hover problem [JSFiddle inside]
Please see the JSFiddle for a pretty clear idea of the problem - http://jsfiddle.net/PeYYZ/
The above sort of does what I want. When I hover over li.parent
, the ul.child
menu fades in, which is fine. I want the sub menu to remain 开发者_如何学Pythonopen, unless the user selects another li.parent
. I tried messing with mouseleave
,but I don't think that's what I'm after.
The logic I need is:
if user hovers over a
li
with classparent
, show it'sul.child
If the user then moves the mouse to somewhere else that isn't a
li.parent
, theul.child
should remain open.- if the user moves to another
li.parent
, then thatli.parent ul.child
should open, and the previously open one should disappear.
thanks in advance
Like this? http://jsfiddle.net/nzFZ6/ I had to edit the CSS part too.
This is my solution: http://jsfiddle.net/MFZ8Q/
The key was selecting only links that are direct descendants of li.parent, then just making sure they are visible.
Hopefully this is what you wanted :)
精彩评论