Skip to content

Instantly share code, notes, and snippets.

@erikakers
Last active August 29, 2015 14:01
Show Gist options
  • Save erikakers/ec5032eff5d00786c274 to your computer and use it in GitHub Desktop.
Save erikakers/ec5032eff5d00786c274 to your computer and use it in GitHub Desktop.
Responsive Width Conditions
App.Helpers.checkWidth = (function(conds) {
conds.init = function() {
$.subscribe('resize', function(){
console.log('resize event fired');
App.Helpers.getWidth();
// if mobile width, mobile media query or mobile ua returns true, broadcast a resize:mobile event
if ( App.Devices.mobile || App.Devices.mobileMQ || App.Devices.mobileCheck ) $.publish('resize:mobile');
// if we are in the tablet realm, lets publish that
if ( App.Devices.tablet || App.Devices.tabletMQ ) $.publish('resize:tablet');
});
};
return conds;
}(App.Helpers.checkWidth || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment