From da1e4636536f4c1ad5b5a7cd310ce38955c61860 Mon Sep 17 00:00:00 2001 From: codecrumb Date: Fri, 10 Apr 2026 03:22:24 +0300 Subject: [PATCH] fix: prevent double-tap zoom on iOS Safari --- index.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 1b974c7..9383799 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ touch grass - + @@ -15,6 +15,10 @@ --background: url(assets/grass.png); } + * { + touch-action: manipulation; + } + body { background: var(--background) !important; background-size: cover !important; @@ -226,6 +230,15 @@ ); }; + let lastTap = 0; + document.addEventListener("touchend", (e) => { + const now = Date.now(); + if (now - lastTap < 500 && now - lastTap > 0) { + e.preventDefault(); + } + lastTap = now; + }, { passive: false }); + document.body.addEventListener("pointerdown", (e) => { e.preventDefault(); const center = { x: e.pageX, y: e.pageY };