mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
aos to cdn
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
import AOS from 'aos'
|
||||
import { loadExternalResource } from '@/lib/utils'
|
||||
import { useEffect } from 'react'
|
||||
// import AOS from 'aos'
|
||||
|
||||
/**
|
||||
* 加载滚动动画
|
||||
* 改从外部CDN读取
|
||||
* https://michalsnik.github.io/aos/
|
||||
*/
|
||||
export default function AOSAnimation() {
|
||||
if (isBrowser) {
|
||||
AOS.init()
|
||||
const initAOS = async () => {
|
||||
Promise.all([
|
||||
loadExternalResource(
|
||||
'https://cdn.bootcdn.net/ajax/libs/aos/2.3.4/aos.js',
|
||||
'js'
|
||||
),
|
||||
loadExternalResource(
|
||||
'https://cdn.bootcdn.net/ajax/libs/aos/2.3.4/aos.css',
|
||||
'css'
|
||||
)
|
||||
]).then(() => {
|
||||
if (window.AOS) {
|
||||
window.AOS.init()
|
||||
}
|
||||
})
|
||||
}
|
||||
useEffect(() => {
|
||||
initAOS()
|
||||
}, [])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user