//------------------------------------------------------------------------ // Test whether client device supports touch. // // Hide the element with ID as ‘touch-only’ if the web page is viewed // on a device that doesn’t have a touch screen. This should work on // all desktop and mobile devices including iOS, Android, Opera, // Chrome, IE, Safari and Windows Phone. // // if (!is_touch_device()) { // document.getElementById('touch-only').style.display='none'; // } // // Credits: http://ctrlq.org/code/19616-detect-touch-screen-javascript //----------------------------------------------------------------------- function isTouchDevice() { return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0) ); }