summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/sidenotes.js8
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;
}