fix: 修复酷炫代码的bug
This commit is contained in:
@@ -5,14 +5,13 @@ import DefaultTheme from 'vitepress/theme-without-fonts'
|
|||||||
import './style.css'
|
import './style.css'
|
||||||
import './rainbow.css'
|
import './rainbow.css'
|
||||||
|
|
||||||
let homePageStyle
|
let homePageStyle = undefined
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
...DefaultTheme,
|
...DefaultTheme,
|
||||||
Layout: () => {
|
Layout: () => {
|
||||||
return h(DefaultTheme.Layout, null, {
|
return h(DefaultTheme.Layout, null, {
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
enhanceApp({ app, router, siteData }) {
|
enhanceApp({ app, router, siteData }) {
|
||||||
@@ -38,12 +37,12 @@ if (typeof window !== 'undefined') {
|
|||||||
document.documentElement.classList.add('browser-safari')
|
document.documentElement.classList.add('browser-safari')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Speed up the rainbow animation on home page
|
|
||||||
function updateHomePageStyle(value) {
|
function updateHomePageStyle(value) {
|
||||||
|
console.log(homePageStyle)
|
||||||
|
console.log(value)
|
||||||
if (value) {
|
if (value) {
|
||||||
if (homePageStyle)
|
if (homePageStyle)
|
||||||
return
|
return
|
||||||
|
|
||||||
homePageStyle = document.createElement('style')
|
homePageStyle = document.createElement('style')
|
||||||
homePageStyle.innerHTML = `
|
homePageStyle.innerHTML = `
|
||||||
:root {
|
:root {
|
||||||
@@ -54,8 +53,9 @@ function updateHomePageStyle(value) {
|
|||||||
else {
|
else {
|
||||||
if (!homePageStyle)
|
if (!homePageStyle)
|
||||||
return
|
return
|
||||||
|
else {
|
||||||
homePageStyle.remove()
|
homePageStyle.remove()
|
||||||
homePageStyle = undefined
|
homePageStyle = undefined
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -82,10 +82,6 @@
|
|||||||
100% { --vp-c-brand: #00a98e; --vp-c-brand-light: #4ad1b4; --vp-c-brand-lighter: #78fadc; --vp-c-brand-dark: #008269; --vp-c-brand-darker: #005d47; --vp-c-brand-next: #009ff7; }
|
100% { --vp-c-brand: #00a98e; --vp-c-brand-light: #4ad1b4; --vp-c-brand-lighter: #78fadc; --vp-c-brand-dark: #008269; --vp-c-brand-darker: #005d47; --vp-c-brand-next: #009ff7; }
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
|
||||||
--vp-c-brand: #00a98e; --vp-c-brand-light: #4ad1b4; --vp-c-brand-lighter: #78fadc; --vp-c-brand-dark: #008269; --vp-c-brand-darker: #005d47; --vp-c-brand-next: #009ff7;
|
|
||||||
animation: rainbow 40s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
:root {
|
:root {
|
||||||
|
|||||||
Reference in New Issue
Block a user