Skip to content

Instantly share code, notes, and snippets.

@seyfer
Last active February 19, 2020 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seyfer/0ac50671d6b28a74c60b1fd70c2d38bb to your computer and use it in GitHub Desktop.
Save seyfer/0ac50671d6b28a74c60b1fd70c2d38bb to your computer and use it in GitHub Desktop.
Do not show v-tooltip for touch devices
function isTouchDevice() {
const prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
const mq = function(query) {
return window.matchMedia(query).matches;
};
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
return true;
}
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
// https://git.io/vznFH
const query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
return mq(query);
}
VTooltip.enabled = !isTouchDevice();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment