mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: 随机背景(修正上次的错误)
This commit is contained in:
@@ -13,7 +13,17 @@ html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside
|
||||
!=partial('includes/loading/index', {}, {cache: true})
|
||||
|
||||
if theme.background
|
||||
#web_bg(style=getBgPath(theme.background))
|
||||
if !Array.isArray(theme.background)
|
||||
#web_bg(style=getBgPath(theme.background))
|
||||
else
|
||||
#web_bg
|
||||
- const bgStyleArr = theme.background.map(getBgPath)
|
||||
script.
|
||||
(function () {
|
||||
const arr = !{JSON.stringify(bgStyleArr)}
|
||||
const randomBgStyle = arr[Math.floor(Math.random() * arr.length)]
|
||||
document.getElementById('web_bg').style = randomBgStyle
|
||||
})()
|
||||
|
||||
!=partial('includes/sidebar', {}, {cache: true})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user