From 74f43317de153881c6dfd128ee4b9366c4d652c0 Mon Sep 17 00:00:00 2001 From: Reinholds Zviedris Date: Mon, 16 Nov 2026 11:47:51 +0200 Subject: [PATCH] fixed mobile view --- index.html | 79 ++++++++++++++++++++++++++++++++++++++++++------------ test.js | 6 ++--- 2 files changed, 65 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index a7b6984..4aea055 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Ballistic Turret Calculator +Ballistic Calculator - +
+
Ballistic Calculator
+ + +
@@ -301,7 +330,7 @@

Optic

Load

-
+
@@ -372,7 +401,7 @@

Weather conditions

-

Ballistic Turret Calculator

+

Turret Calculator

How many clicks to dial for a given drop & distance. Turret and reticle come from Setup → Optic.
@@ -1772,15 +1801,31 @@

Target Card

const tabs = [...document.querySelectorAll('section.tab')]; if (!tabs.some(t => t.dataset.tab === name)) name = 'setup'; tabs.forEach(t => t.classList.toggle('active', t.dataset.tab === name)); - document.querySelectorAll('#tabs button').forEach(b => b.classList.toggle('active', b.dataset.tab === name)); + document.querySelectorAll('#tabMenu button').forEach(b => { + b.classList.toggle('active', b.dataset.tab === name); + if (b.dataset.tab === name) $('menuCur').textContent = b.textContent; + }); + setMenu(false); try { localStorage.setItem(TAB_KEY, name); } catch (e) { /* private mode */ } } -$('tabs').addEventListener('click', e => { +function setMenu(open) { + $('tabs').classList.toggle('open', open); + $('menuBtn').setAttribute('aria-expanded', String(open)); +} +$('menuBtn').addEventListener('click', e => { + e.stopPropagation(); + setMenu(!$('tabs').classList.contains('open')); +}); +$('tabMenu').addEventListener('click', e => { const b = e.target.closest ? e.target.closest('button[data-tab]') : null; if (!b) return; showTab(b.dataset.tab); window.scrollTo(0, 0); }); +document.addEventListener('click', e => { + if (e.target.closest && !e.target.closest('#tabs')) setMenu(false); +}); +document.addEventListener('keydown', e => { if (e.key === 'Escape') setMenu(false); }); // Target rows are rebuilt on add/remove, so listen on the container. $('targetRows').addEventListener('input', e => { diff --git a/test.js b/test.js index 967322c..c409169 100644 --- a/test.js +++ b/test.js @@ -13,10 +13,10 @@ assert(match, 'index.html must contain a