javascript - Expand right floated div to push left div -
so, have
<div style="width:250px;border: 1px solid;overflow:auto" id="container"> <div style="float:left;">vasileostrovsky rayon</div> <div id="rightaligneddiv"> div expanding </div> </div>
how can make #rightaligneddiv
expand on left one. in other words when #rightaligneddiv
wide enough, want push left 1 smaller, , left div can move new line :).
here fiddle demonstrate predicament http://jsfiddle.net/ec9zx/1/
this has solved somehow using css. js solution complicate logic much. , wouldn't elegant one.
window.alterwidth = function() { var testwidth=parseint(document.getelementbyid("testid").style.width); var testwidth1=parseint(document.getelementbyid("rightdiv").style.width); document.getelementbyid("testid").style.width = (testwidth-33)+'px'; document.getelementbyid("rightdiv").style.width = (testwidth1+33)+'px'; var newimg = $('#com_ibm_ioc_spb_kpi_statusbox_412').clone(); $('#rightdiv').append(newimg); }
give id both div , make overflow auto first div.
also try fiddle http://jsfiddle.net/l774v/
Comments
Post a Comment