开发者

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:

  1. if user hovers over a li with class parent, show it's ul.child

  2. If the user then moves the mouse to somewhere else that isn't a li.parent, the ul.child should remain open.

  3. if the user moves to another li.parent, then that li.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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜