Search code examples
javascriptjqueryhtmlcssmenu

Issue in vertical multi-level popup menu using jQuery


I am trying to develop a vertical multi-level popup menu. I am unable to set the child's top against to its parent LI position. The approach I took was, I am calculating outerwidth of the UL tag and top of parent LI tag for the respective left and top positions of the child tag. But It doesn't seem to work well.

If I set left and top using CSS, the first level looks good, but for the rest of the levels the top is always set to 0.

_pm.child.show().css({left:left-2,top:top-1});

And if I use the position function, all the levels are shown as very closer to its parent.

_pm.child.show().position({left:left-2,top:top-1});

What has gone wrong? Here is the Fiddle.


Solution

  • change the mouseout by mouseleave and it will work :)