0

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});

I am not getting what's gone wrong. Here is the fiddle. Can somebody help me?

dda
  • 6,030
  • 2
  • 25
  • 34
Rama Rao M
  • 2,961
  • 11
  • 44
  • 64
  • The wheel does not need re-inventing! http://jqueryui.com/menu/#default – DevlshOne Jul 19 '13 at 12:42
  • Yeah... I know that jQuery Menu.But our requirement is some what different and what ever I have posted here is a sample piece of code only... – Rama Rao M Jul 19 '13 at 12:51

1 Answers1

1

change the mouseout by mouseleave and it will work :)

GwenM
  • 1,198
  • 10
  • 24
  • Yeah buddy, U'r awesome.It does. But whatz the diff b/w mouseout nad mouseleave?And how does it impact on the left&top positions? – Rama Rao M Jul 19 '13 at 13:11
  • have a look here :) http://stackoverflow.com/questions/4258615/what-is-the-difference-between-jquerys-mouseout-and-mouseleave – GwenM Jul 19 '13 at 13:12