✨ (stacked notes) implements overlay
This commit is contained in:
27
src/hooks/useOverlay.hook.ts
Normal file
27
src/hooks/useOverlay.hook.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
|
||||
export const useOverlay = () => {
|
||||
const x = ref(0)
|
||||
|
||||
onMounted(() => {
|
||||
const element = document.querySelector('body')
|
||||
|
||||
useEventListener(
|
||||
element,
|
||||
'scroll',
|
||||
(e) => {
|
||||
const target = e.target as HTMLElement
|
||||
x.value = target.scrollLeft
|
||||
},
|
||||
{
|
||||
passive: true,
|
||||
capture: false
|
||||
}
|
||||
)
|
||||
})
|
||||
return {
|
||||
x
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user