fix sticky problems

This commit is contained in:
isUnknown 2024-04-10 14:55:34 +02:00
parent d9dcd940af
commit ba450cbb1f
15 changed files with 212 additions and 142 deletions

View file

@ -58,10 +58,9 @@ function setWindowHeightFactor() {
const delta = windowHeight - min;
const factor = roundToNearestHalf(delta / 300) + 1;
const head = document.querySelector("head");
const style = document.createElement("style");
style.innerText = `:root { --window-height-factor:${factor} }`;
head.appendChild(style);
document
.querySelector(":root")
.style.setProperty("--window-height-factor", factor);
}
function roundToNearestHalf(num) {
@ -123,9 +122,11 @@ function togglePanel(side) {
if (isOpen) {
document.querySelector("html").style.overflowY = "hidden";
document.querySelector("#main-header").classList.remove("minimized");
} else if (scrollY > 10) {
} else {
document.querySelector("html").style.overflowY = "";
document.querySelector("#main-header").classList.add("minimized");
if (scrollY > 10) {
document.querySelector("#main-header").classList.add("minimized");
}
}
}