diff options
| author | ache <ache@ache.one> | 2025-06-13 03:59:07 +0200 |
|---|---|---|
| committer | ache <ache@ache.one> | 2025-06-13 04:07:19 +0200 |
| commit | 446c675a3e2e71742ffa38d93c0728dc1337ae09 (patch) | |
| tree | b71581cce1372b66fc966e248c0e59ee0131dac1 /src | |
| parent | Add a paragraph about TLD (diff) | |
Fix sidenotes width problem
Diffstat (limited to 'src')
| -rw-r--r-- | src/js/sidenotes.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/js/sidenotes.js b/src/js/sidenotes.js index 591f856..9519c88 100644 --- a/src/js/sidenotes.js +++ b/src/js/sidenotes.js @@ -18,7 +18,11 @@ function getPos(element) { let articles; const resize = () => { for (const [article, sidenote] of articles) { - if (sidenote.offsetWidth < 200 || window.screen.width < 1400) { + const viewportWidth = + window.innerWidth || + document.documentElement.clientWidth || + document.body.clientWidth; + if (sidenote.offsetWidth < 200 || viewportWidth < 1400) { sidenote.innerHTML = ""; return; } @@ -51,7 +55,7 @@ const resize = () => { sidenote.replaceChildren(...newSidenotes); - if (sidenote.offsetWidth < 100 || window.screen.width < 1400) { + if (sidenote.offsetWidth < 100 || viewportWidth < 1400) { sidenote.innerHTML = ""; return; } |