Skip to content

Instantly share code, notes, and snippets.

@walterebert
Created January 20, 2016 12:12
Show Gist options
  • Select an option

  • Save walterebert/ae14a372ae918ba4d928 to your computer and use it in GitHub Desktop.

Select an option

Save walterebert/ae14a372ae918ba4d928 to your computer and use it in GitHub Desktop.
JavaScript: Detect mobile + add class to html root
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