mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
feat: 適配 hexo-blog-encrypt fix: 修復 hexo 新版本下,prismjs 的問題 improvement: 在 pjax 關閉的情況下。減少不必要的全局變量 improvement: 更新依賴版本 improvement: 頁面進入效果優化 improvement: 添加平滑滾動 improvement: 兼容性優化 improvement: 優化 lighthouse 分數 improvement: 優化代碼
33 lines
903 B
Plaintext
33 lines
903 B
Plaintext
#loading-box
|
|
.loading-left-bg
|
|
.loading-right-bg
|
|
.spinner-box
|
|
.configure-border-1
|
|
.configure-core
|
|
.configure-border-2
|
|
.configure-core
|
|
.loading-word= _p('loading')
|
|
|
|
script.
|
|
(()=>{
|
|
const $loadingBox = document.getElementById('loading-box')
|
|
const $body = document.body
|
|
const preloader = {
|
|
endLoading: () => {
|
|
$body.style.overflow = ''
|
|
$loadingBox.classList.add('loaded')
|
|
},
|
|
initLoading: () => {
|
|
$body.style.overflow = 'hidden'
|
|
$loadingBox.classList.remove('loaded')
|
|
}
|
|
}
|
|
|
|
preloader.initLoading()
|
|
window.addEventListener('load',() => { preloader.endLoading() })
|
|
|
|
if (!{theme.pjax && theme.pjax.enable}) {
|
|
btf.addGlobalFn('pjaxSend', () => { preloader.initLoading() }, 'preloader_init')
|
|
btf.addGlobalFn('pjaxComplete', () => { preloader.endLoading() }, 'preloader_end')
|
|
}
|
|
})() |