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
Excellent Tip, @falsarella!
For those who like this sort of thing to not affect their actual markup the following works:
$(function(){
...
var mqClasses = ["visible-xs", "visible-sm", "visible-md", "visible-lg"];
var mq = $("").appendTo($("body"));
$.each(mqClasses, function(idx, val) {
mq.append("");
});
function checkMQ() {
var visible = mq.find(":visible").get(0).className;
return visible.slice(-2);
};
function checkResize(){
switch(checkMQ){
case 'xs' : ...; break;
case 'sm' : ...; break;
...
}
}
$(window).on('resize', checkResize);
checkResize(); //do it once when page loads.