2

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

Dênis Fernandes
  • 174
  • 2
  • 11
  • 1
    You could use JavaScript for that, but it would be nice to see your code so we can actually try fixing it. Make a https://jsfiddle.net/ – fnune Jan 06 '16 at 21:02
  • Duplicate - http://stackoverflow.com/questions/12070759/make-absolute-positioned-div-expand-parent-div-height?rq=1 – Paulie_D Jan 06 '16 at 21:37

2 Answers2

1
$(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');

    });

});
Daniel Varoto
  • 111
  • 1
  • 7
0

Try using jquery:

    $("#divIdNeeded").on("mouseover", function () {
        $("#parentDivId").css("height", "400px"); 
    });
Legeran
  • 117
  • 7