I have created a multilevel drop-down menu. There is a problem when I try to get height of the element at level 2, but level 1 is working correctly. Why?
alert($('ul.sub-1').outerHeight()); // --> 240
alert($('ul.sub-2').outerHeight()); // --> 0
I have created a multilevel drop-down menu. There is a problem when I try to get height of the element at level 2, but level 1 is working correctly. Why?
alert($('ul.sub-1').outerHeight()); // --> 240
alert($('ul.sub-2').outerHeight()); // --> 0
you need to use visibility instead of display. see updated fiddle
ul.sub-menu {
position: absolute;
visibility: hidden;
li:hover > .sub-menu {
visibility: visible;
}