I need a container in bootstrap to be responsive based on the parent div instead of a media query. I can't figure out the best way without to do it, particularly without using javascript, if possible. Currently, on resize, I'm calculated if .span*
divs should be 100% width (if the parent div ends up below 640px) or respect the columning CSS.
Here is a jsfiddle. With the CSS on .somecontainer
the .span*
's inside should layout as if it's mobile - so each column should go full width, if you change the CSS to above 640px, for example, it would re-layout to the columns layout.
Any ideas?
Currently using code similar to this (which is not ideal)
$(document).ready(function(){
$('.somecontainer').on('resize',function(){
if ($('.somecontainer').width() < 640) {
$('.somecontainer').addClass('m');
} else {
$('.somecontainer').removeClass('m');
});
});