diff --git a/web/src/layouts/Base.astro b/web/src/layouts/Base.astro index 6caeb041..b9c395eb 100644 --- a/web/src/layouts/Base.astro +++ b/web/src/layouts/Base.astro @@ -566,7 +566,17 @@ import { brand } from '../lib/brand'; (() => { const root = document.documentElement, header = document.querySelector('.site-header'); new ResizeObserver(() => root.style.setProperty('--header-h', header.offsetHeight + 'px')).observe(header); - const mark = () => (scrollY > 8 ? (root.dataset.scrolled = '') : delete root.dataset.scrolled); + // phones: the header steps aside while scrolling down and returns on the way up (not while it is in use) + const phone = matchMedia('(max-width: 640px)'); + let last = scrollY; + const mark = () => { + scrollY > 8 ? (root.dataset.scrolled = '') : delete root.dataset.scrolled; + const busy = header.contains(document.activeElement) || header.querySelector('details[open]') || !document.getElementById('kb').hidden; + if (!phone.matches || busy || scrollY < header.offsetHeight) delete root.dataset.headerHidden; + else if (scrollY > last + 6) root.dataset.headerHidden = ''; + else if (scrollY < last - 6) delete root.dataset.headerHidden; + if (Math.abs(scrollY - last) > 6) last = scrollY; + }; addEventListener('scroll', mark, { passive: true }); mark(); })(); diff --git a/web/src/pages/[...path].astro b/web/src/pages/[...path].astro index 6cd69522..52d98b42 100644 --- a/web/src/pages/[...path].astro +++ b/web/src/pages/[...path].astro @@ -153,10 +153,13 @@ import Icon from '../components/Icon.astro'; const cn = noteOf(b.c), any = cn || notes.some((n) => n.couplet === b.c); // the bookmark, and beside it the note glyph (shown when this couplet or a phrase in it has a note) const bm = + {/* wide screens: four icons on hover; phones: one ⋯ that opens a menu (the CSS shows one or the other) */} + ; const lm = lineMarks(b.c, b.lines); return b.kind === 'couplet' ?
کسی لفظ کو منتخب کریں تو اس کے معنی اور تلفظ ساتھ نظر آئیں گے؛ کسی عبارت پر نوٹ بھی لکھ سکتے ہیں۔
+