css - Apply class depending on media query screen size -


i using twitter bootstrap. have btn-group. want btn-group , btn-group-justified classes added screens @ or above 768px, , btn-group-vertical class applied screens @ or below 767px. what's easiest way this?

this jquery implementation. if can't change ids classes on buttons, best way can think of it.

$(document).ready(function(){   var changewidth = function(){     if ( $(window).width() < 768 ){     $('.btn-group-justified').removeclass('btn-group-justified').addclass('btn-group-vertical');     } else {       $('.btn-group-vertical').removeclass('btn-group-vertical').addclass('btn-group-justified');     }   };   $(window).resize(changewidth); }); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -