Created
May 10, 2013 14:29
-
-
Save robspangler/5554753 to your computer and use it in GitHub Desktop.
Detects touch screen using Javascript with Modernizr and gives you a handy re-usable variable. Also added an iPad specific variable.
This file contains 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
var isTouch = Modernizr.touch != false; | |
var isiPad = navigator.userAgent.match(/iPad/i) != null; | |
if (isTouch) | |
alert('Touch'); | |
if (isiPad) | |
alert('iPad'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment