Created
January 20, 2016 12:12
-
-
Save walterebert/ae14a372ae918ba4d928 to your computer and use it in GitHub Desktop.
JavaScript: Detect mobile + add class to html root
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
| if (navigator.userAgent.match(/Mobi/)) document.documentElement.className += " is-mobile"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment