mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
动效移动端特殊处理
This commit is contained in:
@@ -35,7 +35,11 @@ const Fireworks = () => {
|
||||
loadFireworks()
|
||||
|
||||
return () => {
|
||||
// 在组件卸载时清理资源(如果需要)
|
||||
// 在组件卸载时清理资源
|
||||
const fireworksElements = document.getElementsByClassName('fireworks')
|
||||
while (fireworksElements.length > 0) {
|
||||
fireworksElements[0].parentNode.removeChild(fireworksElements[0])
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -15,8 +15,26 @@ const MOUSE_FOLLOW = () => {
|
||||
loadExternalResource('/js/mouse-follow.js', 'js').then(url => {
|
||||
window.createMouseCanvas && window.createMouseCanvas()({ type, color })
|
||||
})
|
||||
|
||||
return () => {
|
||||
// 在组件卸载时清理资源
|
||||
const mouseFollowElement = document.getElementById('vixcityCanvas')
|
||||
mouseFollowElement?.parentNode?.removeChild(mouseFollowElement)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return <></>
|
||||
return (
|
||||
<>
|
||||
<style global jsx>
|
||||
{`
|
||||
@media (max-width: 600px) {
|
||||
#vixcityCanvas {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default MOUSE_FOLLOW
|
||||
|
||||
Reference in New Issue
Block a user