jquery - I want to expand the column to fit the screen if there is no other column -
i using bootstrap. data json. can have maximum 6 tables have put in 1 row below.
<div class="row"> <div class="col-sm-6 col-xs-12"></div> (table one) <div class="col-sm-6 col-xs-12"></div> (table two) <div class="col-sm-6 col-xs-12"></div> (table three) <div class="col-sm-6 col-xs-12"></div> (table four) <div class="col-sm-6 col-xs-12"></div> (table five) <div class="col-sm-6 col-xs-12"></div> (table six) </div> i want 4 wide open fitting screen having sum of 12 when there no table three. how can that?
find number of table / 12 col. prob need remainder check offset or in case number of table 5... anyway should ideas start. a
var tablecount = $('table').length; var maxcolcount = 12; var rowwidth = maxcol/tablecount // eg 4 table / 12 row = 3 var str = ' <div class="row">'; for(var = 0; < tablecount; i++) { str .= '<div class="col-sm-'+ rowwidth +' col-xs-12"></div>'; } var str .= '</div>'; consoloe.log(str); ps: opps did't see json part...... anyhow....
Comments
Post a Comment