feat: add emoji to pot animation

This commit is contained in:
YunYouJun
2022-04-17 03:27:55 +08:00
parent 7163fd350b
commit bbd9f840b5
5 changed files with 86 additions and 21 deletions

View File

@@ -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 {