diff options
Diffstat (limited to 'core/util.js')
-rw-r--r-- | core/util.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/util.js b/core/util.js index 058b402..e34f5d8 100644 --- a/core/util.js +++ b/core/util.js @@ -241,6 +241,18 @@ Util.stopEvent = function (e) { e.preventDefault(); }; +// Touch detection +Util.isTouchDevice = ('ontouchstart' in document.documentElement) || + // requried for Chrome debugger + (document.ontouchstart !== undefined) || + // required for MS Surface + (navigator.maxTouchPoints > 0) || + (navigator.msMaxTouchPoints > 0); +window.addEventListener('touchstart', function onFirstTouch() { + Util.isTouchDevice = true; + window.removeEventListener('touchstart', onFirstTouch, false); +}, false); + Util._cursor_uris_supported = null; Util.browserSupportsCursorURIs = function () { |