fix: disable page scroll when mobile nav is opened
This commit is contained in:
parent
b5fd68b600
commit
eff04fd913
1 changed files with 13 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue