Skip to content

Instantly share code, notes, and snippets.

@rnarian
Forked from tomblanchard/mini-modernizr.html
Created April 5, 2016 12:33
Show Gist options
  • Save rnarian/d9cabed98bb961ed68eeb35bea0e1235 to your computer and use it in GitHub Desktop.
Save rnarian/d9cabed98bb961ed68eeb35bea0e1235 to your computer and use it in GitHub Desktop.
Mini Modernizr: I only ever use Modernizr mostly to check for JS and / or touch screen devices. This tiny piece of code will replace the classes which are on the `<html>` element `no-js` with `js` and `no-touch` with `touch`.
<script>!function(a,b){"use strict";b.documentElement.className=b.documentElement.className.replace("no-js","js"),("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(document.documentElement.className=document.documentElement.className.replace("no-touch","touch"))}(window,document);</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment