feat: add emoji to pot animation
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useElementBounding, useIntersectionObserver } from '@vueuse/core'
|
||||
import { useElementBounding } from '@vueuse/core'
|
||||
import type { Ref } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
/**
|
||||
* trigger show invisible element
|
||||
@@ -8,16 +7,14 @@ import { ref } from 'vue'
|
||||
* @returns
|
||||
*/
|
||||
export function useInvisibleElement(target: Ref<HTMLElement>) {
|
||||
const isVisible = ref(false)
|
||||
const { top } = useElementBounding(target)
|
||||
useIntersectionObserver(target, ([{ isIntersecting }]) => {
|
||||
isVisible.value = isIntersecting
|
||||
|
||||
const isVisible = computed(() => {
|
||||
return window.scrollY < top.value
|
||||
})
|
||||
|
||||
const show = () => {
|
||||
// scroll when collapse is not visible
|
||||
if (!isVisible.value)
|
||||
window.scrollTo(0, top.value)
|
||||
window.scrollTo(0, top.value)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user