javascript - Jquery append() on inner div while expanding the outer div so that the inner div elements fits inside -
i have div structure similar this. i'm using jquery append elements inside div id append. however, outer div doesn't expand automatically fit appended elements.
<div class="well" id='expand'> <div class="container"> <!-- other divs --> </div> <div id= "append"> </div> </div i solved issue increasing height of outer div i.e.
var div_height = $('#expand').height(); $('#expand').css({"height":div_height + append_height}) is there better way this?
you pure css using min-height , height:auto causes expand div adjust height according content:
#expand{ height:auto; min-height:50px; height:auto !important; /* ie not support min-height */ } also add height:auto !important; child element mobile support.
Comments
Post a Comment