fix: disable page scroll when mobile nav is opened

This commit is contained in:
Matthieu Bessat 2023-05-21 22:46:45 +02:00
parent b5fd68b600
commit eff04fd913

View file

@ -33,3 +33,16 @@
</div>
</div>
</header>
<script>
// workaround to limit the page scroll if the mobile nav is opened
const nav_button = document.getElementById("navi-toggle")
nav_button.addEventListener("change", event => {
if (event.target.checked) {
document.body.style.overflow = "hidden";
}
if (!event.target.checked) {
document.body.style.overflow = "initial";
}
})
</script>