Created
April 3, 2013 14:35
-
-
Save 4rn0/5301749 to your computer and use it in GitHub Desktop.
Modernizr.touch extended
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
Modernizr.addTest("touch", function () { | |
var e; | |
if ("ontouchstart" in window || Modernizr.prefixed("MaxTouchPoints", navigator) > 1 || window.DocumentTouch && document instanceof DocumentTouch) { | |
e = true | |
} else { | |
var t = ["@media (", Modernizr._prefixes.join("touch-enabled),("), "heartz", ")", "{#modernizr{top:9px;position:absolute}}"].join(""); | |
Modernizr.testStyles(t, function (t) { | |
e = t.offsetTop === 9 | |
}) | |
} | |
return e | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment