feat: bg 6s crossfade rotate, sakura fall, LXGW WenKai font
This commit is contained in:
@@ -129,7 +129,7 @@ category_img: transparent # 分类页顶图
|
|||||||
category_per_img: transparent # 单个分类页顶图
|
category_per_img: transparent # 单个分类页顶图
|
||||||
footer_img: transparent # 页脚背景图
|
footer_img: transparent # 页脚背景图
|
||||||
|
|
||||||
background: https://image.987119.xyz/uploads/2026/07/18c0005c5dac2c14635.webp # 全站背景图
|
background: https://image.987119.xyz/uploads/2026/07/18c0005c5dac2c14635.webp # 全站背景图(数组形式请在 _config.yml 的 theme_config 里配置)
|
||||||
|
|
||||||
index_site_info_top: 200px # 首页站点信息距顶部距离
|
index_site_info_top: 200px # 首页站点信息距顶部距离
|
||||||
index_top_img_height: 400px # 首页封面图高度
|
index_top_img_height: 400px # 首页封面图高度
|
||||||
|
|||||||
@@ -218,6 +218,10 @@ theme_config:
|
|||||||
head:
|
head:
|
||||||
- <meta name="referrer" content="no-referrer">
|
- <meta name="referrer" content="no-referrer">
|
||||||
- <link rel="stylesheet" href="/css/custom.css">
|
- <link rel="stylesheet" href="/css/custom.css">
|
||||||
|
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/style.css">
|
||||||
|
bottom:
|
||||||
|
- <script src="/js/background-rotate.js"></script>
|
||||||
|
- <script src="/js/sakura.js"></script>
|
||||||
|
|
||||||
code_blocks:
|
code_blocks:
|
||||||
theme: pale night
|
theme: pale night
|
||||||
|
|||||||
@@ -152,3 +152,22 @@ html:not([data-theme="dark"]) #post-info #post-meta i {
|
|||||||
font-size: 2.73em !important;
|
font-size: 2.73em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ==================== 背景轮换淡入时长(配合 3 秒切换) ==================== */
|
||||||
|
#web_bg.bg-animation {
|
||||||
|
animation-duration: 1.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==================== 全站字体:霞鹜文楷 (LXGW WenKai) ==================== */
|
||||||
|
/* 仅替换正文字体,代码块保持主题自带的等宽字体 */
|
||||||
|
body,
|
||||||
|
#body-wrap,
|
||||||
|
#article-container,
|
||||||
|
#post-info,
|
||||||
|
#aside-content,
|
||||||
|
#nav,
|
||||||
|
.site-page,
|
||||||
|
footer#footer,
|
||||||
|
#pagination {
|
||||||
|
font-family: "LXGW WenKai", "LXGW WenKai Screen", "Microsoft YaHei", "PingFang SC", sans-serif !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* 全站背景图定时轮换(每 6 秒切换一张,交叉淡入淡出) */
|
||||||
|
(function () {
|
||||||
|
var bgList = [
|
||||||
|
'https://image.987119.xyz/uploads/2026/07/18c0005c5dac2c14635.webp',
|
||||||
|
'https://image.987119.xyz/uploads/2026/07/18c099240bbbdcbb113.webp',
|
||||||
|
'https://image.987119.xyz/uploads/2026/07/18c0993b4e03a5c5599.webp'
|
||||||
|
]
|
||||||
|
var webBg = document.getElementById('web_bg')
|
||||||
|
if (!webBg || bgList.length < 2) return
|
||||||
|
|
||||||
|
// 覆盖层:用于交叉淡入,避免背景瞬间硬切
|
||||||
|
var overlay = document.createElement('div')
|
||||||
|
overlay.id = 'web_bg_overlay'
|
||||||
|
overlay.style.cssText =
|
||||||
|
'position:fixed;top:0;left:0;width:100%;height:100%;z-index:-1;' +
|
||||||
|
'background-size:cover;background-position:center;opacity:0;' +
|
||||||
|
'transition:opacity 1.5s ease;'
|
||||||
|
document.body.appendChild(overlay)
|
||||||
|
|
||||||
|
var idx = 0
|
||||||
|
var DURATION = 1500 // 淡入淡出时长(ms),须与 CSS transition 一致
|
||||||
|
|
||||||
|
function swap() {
|
||||||
|
idx = (idx + 1) % bgList.length
|
||||||
|
var url = 'url("' + bgList[idx] + '")'
|
||||||
|
// 新图先放到覆盖层并淡入,盖住旧图
|
||||||
|
overlay.style.backgroundImage = url
|
||||||
|
void overlay.offsetWidth // 强制 reflow,确保过渡生效
|
||||||
|
overlay.style.opacity = '1'
|
||||||
|
// 过渡结束后,把底层也换成新图,再将覆盖层淡出,实现无缝循环
|
||||||
|
setTimeout(function () {
|
||||||
|
webBg.style.backgroundImage = url
|
||||||
|
webBg.style.backgroundSize = 'cover'
|
||||||
|
webBg.style.backgroundPosition = 'center'
|
||||||
|
overlay.style.opacity = '0'
|
||||||
|
}, DURATION)
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(swap, 6000)
|
||||||
|
})()
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/* 樱花飘落效果:动态生成花瓣,CSS 动画飘落+左右摇摆+旋转 */
|
||||||
|
(function () {
|
||||||
|
if (document.getElementById('sakura-container')) return
|
||||||
|
|
||||||
|
// 容器:铺满全屏、不拦截鼠标事件
|
||||||
|
var container = document.createElement('div')
|
||||||
|
container.id = 'sakura-container'
|
||||||
|
container.style.cssText =
|
||||||
|
'position:fixed;top:0;left:0;width:100%;height:100%;' +
|
||||||
|
'pointer-events:none;z-index:9999;overflow:hidden;'
|
||||||
|
document.body.appendChild(container)
|
||||||
|
|
||||||
|
// 样式与飘落关键帧(S 形摆动 + 旋转)
|
||||||
|
var style = document.createElement('style')
|
||||||
|
style.textContent =
|
||||||
|
'.sakura-petal{' +
|
||||||
|
' position:absolute;top:-12%;' +
|
||||||
|
' background:#ffb7c5;border-radius:100% 0 100% 0;' +
|
||||||
|
' opacity:.85;will-change:transform;' +
|
||||||
|
' animation:sakura-fall linear infinite;' +
|
||||||
|
'}' +
|
||||||
|
'@keyframes sakura-fall{' +
|
||||||
|
' 0%{transform:translate(0,-12vh) rotate(0deg);}' +
|
||||||
|
' 25%{transform:translate(18px,25vh) rotate(90deg);}' +
|
||||||
|
' 50%{transform:translate(-18px,50vh) rotate(180deg);}' +
|
||||||
|
' 75%{transform:translate(18px,75vh) rotate(270deg);}' +
|
||||||
|
' 100%{transform:translate(0,112vh) rotate(360deg);}' +
|
||||||
|
'}'
|
||||||
|
document.head.appendChild(style)
|
||||||
|
|
||||||
|
var PETALS = 28
|
||||||
|
for (var i = 0; i < PETALS; i++) {
|
||||||
|
var p = document.createElement('div')
|
||||||
|
p.className = 'sakura-petal'
|
||||||
|
var size = 8 + Math.random() * 10 // 8~18px
|
||||||
|
p.style.width = size + 'px'
|
||||||
|
p.style.height = size + 'px'
|
||||||
|
p.style.left = Math.random() * 100 + 'vw'
|
||||||
|
p.style.background = Math.random() > 0.5 ? '#ffb7c5' : '#ffc8d6'
|
||||||
|
p.style.animationDuration = (6 + Math.random() * 6).toFixed(2) + 's' // 6~12s
|
||||||
|
p.style.animationDelay = (-Math.random() * 12).toFixed(2) + 's' // 错落起步
|
||||||
|
container.appendChild(p)
|
||||||
|
}
|
||||||
|
})()
|
||||||
Reference in New Issue
Block a user