Skip to content

Instantly share code, notes, and snippets.

@4rn0
Created April 3, 2013 14:35
Show Gist options
  • Save 4rn0/5301749 to your computer and use it in GitHub Desktop.
Save 4rn0/5301749 to your computer and use it in GitHub Desktop.
Modernizr.touch extended
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