1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

On touchscreen devices, tooltip now disappears on scroll or after 10 seconds

This commit is contained in:
AmateurAudioDude
2024-08-03 00:55:22 +10:00
committed by GitHub
parent cfcfd421bd
commit 72a1b77aaf

View File

@@ -908,6 +908,11 @@ function initTooltips() {
posX -= tooltipWidth / 2; posX -= tooltipWidth / 2;
posY -= tooltipHeight + 10; posY -= tooltipHeight + 10;
tooltip.css({ top: posY, left: posX, opacity: 1 }); // Set opacity to 1 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)); }, 500));
}, function() { }, function() {
// Clear the timeout if the mouse leaves before the delay completes // Clear the timeout if the mouse leaves before the delay completes