stop using visualviewport, because it made things worse

This commit is contained in:
hippoz 2022-09-02 15:13:25 +03:00
parent 2f66692255
commit 254bec0a48
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -9,21 +9,12 @@ function initViewportSizeHandler() {
root.style.setProperty("--viewportWidth", "100dvw");
root.style.setProperty("--viewportHeight", "100dvh");
} else if (method === "javascriptResponsive") {
if (window.visualViewport) {
const updateUnits = () => {
root.style.setProperty("--viewportWidth", `${window.visualViewport.width}px`);
root.style.setProperty("--viewportHeight", `${window.visualViewport.height}px`);
};
window.visualViewport.addEventListener("resize", updateUnits);
updateUnits();
} else {
const updateUnits = () => {
root.style.setProperty("--viewportWidth", `${window.innerWidth}px`);
root.style.setProperty("--viewportHeight", `${window.innerHeight}px`);
};
window.addEventListener("resize", updateUnits);
updateUnits();
}
const updateUnits = () => {
root.style.setProperty("--viewportWidth", `${window.innerWidth}px`);
root.style.setProperty("--viewportHeight", `${window.innerHeight}px`);
};
window.addEventListener("resize", updateUnits);
updateUnits();
} else if (method === "normalUnits") {
root.style.setProperty("--viewportWidth", "100vw");
root.style.setProperty("--viewportHeight", "100vh");