Skip to content

Instantly share code, notes, and snippets.

@danklammer
Forked from daveespionage/touch_detect.js
Last active August 6, 2024 03:11
Show Gist options
  • Save danklammer/ea6feb0866484bceeb6f to your computer and use it in GitHub Desktop.
Save danklammer/ea6feb0866484bceeb6f to your computer and use it in GitHub Desktop.
/*=========== Touch support detection ===========*/
function detectTouchSupport() {
const html = document.documentElement;
html.classList.add('no-touch'); // Default to no-touch
if ('ontouchend' in document) {
html.classList.remove('no-touch');
html.classList.add('touch');
}
}
detectTouchSupport();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment