Set doc-height when window load fires

This commit is contained in:
Cohee 2024-03-11 00:54:37 +02:00
parent d0fec68768
commit c8c08fd5d9
1 changed files with 8 additions and 6 deletions

View File

@ -5558,12 +5558,14 @@
toastr.options.positionClass = "toast-top-center"; // Where to position the toast container
</script>
<script>
const documentHeight = () => {
const doc = document.documentElement
doc.style.setProperty('--doc-height', `${window.innerHeight}px`)
}
window.addEventListener('resize', documentHeight)
documentHeight()
window.addEventListener('load', (event) => {
const documentHeight = () => {
const doc = document.documentElement;
doc.style.setProperty('--doc-height', `${window.innerHeight}px`);
}
window.addEventListener('resize', documentHeight);
documentHeight();
});
</script>
</body>