From 72a1b77aaf828ffac222cab39cad314842964ad1 Mon Sep 17 00:00:00 2001 From: AmateurAudioDude <168192910+AmateurAudioDude@users.noreply.github.com> Date: Sat, 3 Aug 2024 00:55:22 +1000 Subject: [PATCH] On touchscreen devices, tooltip now disappears on scroll or after 10 seconds --- web/js/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/js/main.js b/web/js/main.js index 88fd336..ddbea3f 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -908,6 +908,11 @@ function initTooltips() { posX -= tooltipWidth / 2; posY -= tooltipHeight + 10; tooltip.css({ top: posY, left: posX, opacity: 1 }); // Set opacity to 1 + // For touchscreen devices + if ((/Mobi|Android|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) && ('ontouchstart' in window || navigator.maxTouchPoints)) { + setTimeout(() => { $('.tooltiptext').remove(); }, 10000); + document.addEventListener('touchstart', function() { setTimeout(() => { $('.tooltiptext').remove(); }, 500); }); + } }, 500)); }, function() { // Clear the timeout if the mouse leaves before the delay completes