Skip to content

Instantly share code, notes, and snippets.

View wallin's full-sized avatar

Sebastian Wallin wallin

View GitHub Profile
@wallin
wallin / mobilecss.js
Created January 3, 2014 12:59
Simple way of detecting and adding body-classes for mobile devices. Classes added: 'mobile', 'iphone', 'android'
(function(d, l, c) {
while(c=l.pop()){
if(navigator.userAgent.match(new RegExp(c, 'i'))){
d[c]=!0;
d.documentElement.className+=' '+c;
}
}
}(document, ['iphone', 'mobile', 'android']));