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
I have prepered a super lightweight library to deal with events fired when window width and Bootstrap breakpoint is changed - responsive-breakpoint-tester
var viewport = new ResponsiveTester();
$('body').on('in.screen.xs', function(event, devices) {
// Code executed when viewport is was changed to xs
});
$('body').on('out.screen.xs', function(event, devices) {
// Code executed when viewport is no longer xs
});
Other features like current breakpoint check are also included:
if (viewport.is('xs')) {
// Executed only on xs breakpoint
}
if (viewport.is('!=xs')) {
// Executed on all breakpoints that are not equal xs (sm, md, lg)
}
if (viewport.is('md')) {
// Executed on breakpoints that are larger than md (lg)
}
Bootstrap 4 and Foundation configuraions are supported, more info on GitHub Repository