Skip to content

Instantly share code, notes, and snippets.

@haroldao
Created November 9, 2021 12:32
Show Gist options
  • Save haroldao/6a3a57436ba65b3e4817930aec21a4f3 to your computer and use it in GitHub Desktop.
Save haroldao/6a3a57436ba65b3e4817930aec21a4f3 to your computer and use it in GitHub Desktop.
Check if is touch device
function is_touch_device() {
return 'ontouchstart' in window // works on most browsers
|| 'onmsgesturechange' in window; // works on ie10
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment