diff --git a/README.md b/README.md index f70201a..356dbca 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ - [x] 简洁的响应式设计 - [x] 流畅的动画和页面过渡 +- [x] 丝滑的阻尼滚动效果(自定义开启/关闭) - [x] 两列布局 - [x] 阅读时间 - [x] 字数统计 @@ -27,9 +28,12 @@ - [x] 分类 - [x] 归档 - [x] 动态 +- [x] 圈子 - [x] 关于 +- [x] 留言板 - [x] 友情链接 - [x] 推荐文章 +- [x] 置顶文章 - [x] 谷歌广告 - [x] 内置 404 页面 - [x] Sitemap 支持 @@ -114,6 +118,7 @@ date: 文章创建日期 updated: 文章更新日期 cover: "封面图URL (为空默认随机内置封面 /public/assets/images/banner)" recommend: false # 是否推荐文章 +top: false # 是否置顶文章 hide: false # 是否隐藏文章 --- ``` diff --git a/src/config.ts b/src/config.ts index 3c9043f..be1b321 100644 --- a/src/config.ts +++ b/src/config.ts @@ -50,4 +50,6 @@ export default { // 文章页广告(不填不开启) articleAD_Slot: `` }, + // 阻尼滚动效果开关 + LenisScroll: true } \ No newline at end of file diff --git a/src/scripts/BackTop.ts b/src/scripts/BackTop.ts index e2f9b81..65e8883 100644 --- a/src/scripts/BackTop.ts +++ b/src/scripts/BackTop.ts @@ -15,7 +15,7 @@ const scrollChangeFn = () => { const backTopFn = () => { (window as any).vhlenis && (window as any).vhlenis.stop(); window.scrollTo({ top: 0, behavior: "smooth" }); - (window as any).vhlenis.start(); + (window as any).vhlenis && (window as any).vhlenis.start(); }; // 页面更新,初始化函数====== // 回顶部DOM diff --git a/src/scripts/Init.ts b/src/scripts/Init.ts index 8e66b92..3bc16cf 100644 --- a/src/scripts/Init.ts +++ b/src/scripts/Init.ts @@ -1,6 +1,4 @@ import { inRouter, outRouter } from "../utils/updateRouter"; -// 鼠标滚动阻尼效果 -import LenisInit from './Lenis'; // 初始化文章代码块 import codeInit from "../scripts/Code"; // 初始化视频播放器 @@ -31,7 +29,7 @@ import initMobileSidebar from "../scripts/MobileSidebar"; import GoogleAdInit from "../scripts/GoogleAd"; // Han Analytics 统计 import SITE_INFO from "../config"; -const { HanAnalytics } = SITE_INFO; +const { HanAnalytics, LenisScroll } = SITE_INFO; import { LoadScript } from "../utils/index"; // ============================================================ @@ -41,7 +39,7 @@ const videoList: any[] = []; const MusicList: any[] = []; const indexInit = async (only: boolean = true) => { // 鼠标滚动阻尼效果 - only && LenisInit(); + LenisScroll && only && (await import('./Lenis')).default(); // 预加载搜索数据 only && searchFn(""); // 初始化搜索功能 diff --git a/src/scripts/Lenis.ts b/src/scripts/Lenis.ts index c0bbc21..e01c556 100644 --- a/src/scripts/Lenis.ts +++ b/src/scripts/Lenis.ts @@ -16,7 +16,7 @@ let clearTimer: any = null; (window as any).vhlenis.stop(); clearTimer = setTimeout(() => { (window as any).vhlenis.start(); - }, 566); + }, 288); } } catch { scrollStatus = null;