fix: disable page scroll when mobile nav is opened
This commit is contained in:
parent
8da6e620ea
commit
7ad361d49f
1 changed files with 13 additions and 0 deletions
|
@ -33,3 +33,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</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>
|
||||||
|
|
Loading…
Reference in a new issue