which is the fastest and easy way to fire when bootstrap-responsive.css media queries go in action?
go in action = when you resize window to mobile width and site is
This already answered on stackoverflow from Terryfrancis is still useful in my Bootstrap 4 application, when I wanted to change the class of a non-bootstrap module into .col-md in my Bootstrap 4 application.
I used both onload and window resize function:
// on load
if ($(window).width() > 575 && $(window).width() < 992) {
$('div').addClass('col-md-6').removeClass('col-md-4');
} else if ($(window).width() > 992) {
$('div').addClass('col-md-4').removeClass('col-md-6');
}
// on user resizes browser window
$( window ).resize(function() {
if ($(window).width() > 575 && $(window).width() < 992) {
$('div').addClass('col-md-6').removeClass('col-md-4');
} else if (jQuery(window).width() > 992) {
$('div').addClass('col-md-4').removeClass('col-md-6');
}
});