Created
September 5, 2012 00:38
-
-
Save djalmaaraujo/3628546 to your computer and use it in GitHub Desktop.
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
/* | |
* The Modernizr.touch test only indicates if the browser supports | |
* touch events, which does not necessarily reflect a touchscreen | |
* device, as evidenced by tablets running Windows 7 or, alas, | |
* the Palm Pre / WebOS (touch) phones. | |
* | |
* Additionally, Chrome (desktop) used to lie about its support on this, | |
* but that has since been rectified: crbug.com/36415 | |
* | |
* We also test for Firefox 4 Multitouch Support. | |
* | |
* For more info, see: modernizr.github.com/Modernizr/touch.html | |
*/ | |
tests['touch'] = function() { | |
var bool; | |
if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { | |
bool = true; | |
} else { | |
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { | |
bool = node.offsetTop === 9; | |
}); | |
} | |
return bool; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment