Add functionality to nav select

This commit is contained in:
Daniel Kluge 2023-12-17 00:23:57 +01:00
parent 6ebad3b068
commit a7122a1e34

View File

@ -60,6 +60,16 @@ const nextEntryLink = nextEntry ?
<span></span> <span></span>
</nav> </nav>
<script>
const selectElements = document.querySelectorAll(".selectField");
selectElements.forEach((el) => {
el.addEventListener("change", (event) => {
window.location.pathname = (event.target as HTMLSelectElement)?.value;
});
});
</script>
<style lang="scss"> <style lang="scss">
nav { nav {
display: grid; display: grid;
@ -128,6 +138,7 @@ a:hover {
.leftSelectSpace { .leftSelectSpace {
grid-area: 1/2; grid-area: 1/2;
text-align: right;
} }
.leftSelectSpaceSync { .leftSelectSpaceSync {