i tried googleing found nothing so here i'am
Lets say u have this
<div class="resizable">
<div class='row'>
<div class='col-xs-12 col-md-4' style='border:1px solid red;'> HELLo </div>
</div>
</div>
this work as expected and in > md screens the col will take 33%, yet my question is.
is there a way to make col-md/col-xs respondent to its container not to the viewport in case of resizing ?
i was thinking of a simple js solution that before it starts resizing div it can record current width of .resizable, and manipulate col-xs, col-md by removing or readding according to the new size after resizing is done..
but if there is something already existent or a better solution i would love if you share it .
thanks
Current solution :
As im using jquery-ui for resizing i wrote something simple:
$(document).on('resizestop','.resizable',function(){
$(this).find('.row').each(function(){
var w = $(this).innerWidth();
var c=$(this).children('div');
if(w <= 768){
c.attr('class', c.attr('class').replace(' col-md-',' w-col-md-'));
c.attr('class', c.attr('class').replace(' col-sm-',' w-col-sm-'));
c.attr('class', c.attr('class').replace(' col-lg-',' w-col-lg-'));
}else if(w < 960){
c.attr('class', c.attr('class').replace(' w-col-sm-',' col-sm-'));
c.attr('class', c.attr('class').replace(' col-md-',' w-col-md-'));
c.attr('class', c.attr('class').replace(' col-lg-',' w-col-lg-'));
}else if(w >= 960){
c.attr('class', c.attr('class').replace(' w-col-sm-',' col-sm-'));
c.attr('class', c.attr('class').replace(' w-col-lg-',' col-lg-'));
c.attr('class', c.attr('class').replace(' w-col-md-',' col-md-'));
}
});
});
this simply remove all col-md,col-lg if the width of parent is less than XX px, and restore it if its larger.
let me know what you think about this approach :).
note that this dictate that col-xs be the first in class, and any other responsive class follows. thanks