Dênis Fernandes Dênis Fernandes - 4 months ago 16
CSS Question

Making dropdown menu(absolute position) increase parent height

i have a regular menu, with 2 dropdown levels using

position:absolute;
.

What i want to achieve is that these submenus increase the height of the parent element.
Just like the image below:
enter image description here
Somebody knows a way to do that? if possible using css only?

Thanks in advance

Answer
$(function(){

    $("ul.menubar").mouseover(function(){

        $(this).mousemove(function(){

            var bigger=0;
            var offset=0;

            $(this).find(" li ul li:last-child:visible").each(function(i,elem) {
                offset = $(elem).offset().top + $(elem).height() - 120;
                if(offset>bigger)bigger=offset;
            });

            $('#div_menu').height(bigger);

        });

    }).mouseout(function() {

        $('#div_menu').css('height','auto');

    });

});