if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { // Touch events are supported } function supportsTouch() { return ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0) || (typeof el.ongesturestart == "function") }