mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-18 12:37:05 +02:00
This will allow us to iterate faster on documentation for multiple versions of Talos. Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
47 lines
976 B
Vue
47 lines
976 B
Vue
<template>
|
|
<header id="header">
|
|
<div
|
|
class="max-w-6xl mx-auto py-6 flex flex-wrap items-center justify-between"
|
|
>
|
|
<Logo></Logo>
|
|
<Dropdown></Dropdown>
|
|
</div>
|
|
</header>
|
|
</template>
|
|
|
|
<script>
|
|
import Logo from '~/components/Logo.vue'
|
|
import Dropdown from '~/components/Dropdown.vue'
|
|
|
|
export default {
|
|
name: 'Header',
|
|
components: {
|
|
Logo,
|
|
Dropdown
|
|
},
|
|
|
|
mounted() {
|
|
window.addEventListener('scroll', this.handleScroll)
|
|
},
|
|
|
|
destroyed() {
|
|
window.removeEventListener('scroll', this.handleScroll)
|
|
},
|
|
|
|
methods: {
|
|
handleScroll() {
|
|
const distanceY = window.pageYOffset || document.documentElement.scrollTop
|
|
const shrinkOn = 240
|
|
const shrinkOff = 140
|
|
const headerEl = document.getElementById('header')
|
|
|
|
if (distanceY > shrinkOn) {
|
|
headerEl.classList.add('scrolled')
|
|
} else if (distanceY < shrinkOff) {
|
|
headerEl.classList.remove('scrolled')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|