Created
January 3, 2014 12:59
-
-
Save wallin/8237512 to your computer and use it in GitHub Desktop.
Simple way of detecting and adding body-classes for mobile devices. Classes added: 'mobile', 'iphone', 'android'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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'])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment