chore: improve threshold management
This commit is contained in:
@@ -2,24 +2,13 @@
|
|||||||
const isLargeScreen = useMediaQuery('(min-width: 1024px)')
|
const isLargeScreen = useMediaQuery('(min-width: 1024px)')
|
||||||
|
|
||||||
const appConfig = useAppConfig()
|
const appConfig = useAppConfig()
|
||||||
|
const { height } = useWindowSize()
|
||||||
|
|
||||||
const scrollThreshold = ref<number>(0)
|
const scrollThreshold = computed(() => {
|
||||||
|
return Math.round(height.value * 0.68);
|
||||||
onMounted(() => {
|
|
||||||
const updateThreshold = () => {
|
|
||||||
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
||||||
|
|
||||||
scrollThreshold.value = Math.round(viewportHeight * 0.68);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateThreshold()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const effectiveScrollThreshold = computed(() => {
|
const { isScrolled } = useScroll(scrollThreshold.value)
|
||||||
return import.meta.client ? scrollThreshold.value : 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
const { isScrolled } = useScroll(effectiveScrollThreshold.value)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -61,6 +50,7 @@ const { isScrolled } = useScroll(effectiveScrollThreshold.value)
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 3rem 2rem;
|
padding: 3rem 2rem;
|
||||||
height: 68vh;
|
height: 68vh;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-header--sticky {
|
.app-header--sticky {
|
||||||
|
|||||||
Reference in New Issue
Block a user