update pc menu behavior

This commit is contained in:
ClovertaTheTrilobita 2026-04-25 00:13:55 +03:00
parent 0541250822
commit 18ddbb82f1

View file

@ -148,11 +148,15 @@ const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3);
display: none; display: none;
} }
@media (min-width: 1300px) { @media (min-width: 1200px) {
.post-menu { .post-menu {
--content-width: 90ch; --content-width: 90ch;
--menu-width: 180px; --menu-width: clamp(
--menu-gap: 2.2rem; 140px,
calc((100vw - 1200px) * 0.42 + 140px),
260px
);
--menu-gap: 0rem;
position: fixed; position: fixed;
top: 8.5rem; top: 8.5rem;
@ -170,7 +174,7 @@ const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3);
} }
} }
@media (max-width: 1299px) { @media (max-width: 1200px) {
.post-menu-mobile-toggle { .post-menu-mobile-toggle {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -304,7 +308,7 @@ const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3);
}); });
const updateVisibility = () => { const updateVisibility = () => {
if (window.innerWidth >= 1300) { if (window.innerWidth >= 1200) {
btn.classList.remove("is-visible"); btn.classList.remove("is-visible");
closeMenu(); closeMenu();
return; return;
@ -319,7 +323,7 @@ const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3);
}; };
const updateCurrentHeading = () => { const updateCurrentHeading = () => {
if (window.innerWidth >= 1300) return; if (window.innerWidth >= 1200) return;
headingItems = getHeadingElements(); headingItems = getHeadingElements();