惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

Fgaoxing

MiniGFM:3KB的轻量Markdown渲染库 Go反射:性能瓶颈与零拷贝优化 至全体朋友 Goh:一款Go语言的预编译快速模板引擎。(Benchmark排名第一) 【预告】关于函数传参时栈的变化 【谈谈当下】青少年口中的垃圾话语 推一下 Vercel 加速节点 网站优化小窍门 【显微镜下的世界】0x1 【Hexo】优化教程 【CDNN】CDNN再添一员 懒加载的妙用:缓存篇 【FastJump.js】简单的快速跳转技术 BiliBili崩了 【New Bing】New Bing免代理申请和使用 simplest-server Python实现文件查重 放开想,越离谱越好 2022 夏季应用推荐
【LSP】微型滚动动画库
Fgaoxing · 2024-05-19 · via Fgaoxing

为了给工作室写个新的官网,简洁还不能显得很Low,于是我写了这个

LightScrollPage

LightScrollPage(简称 “LSP”),一个基于原生JS的微型滚动动画库,不需要依赖,只需要一个JS文件,源代码小于1KB

¶如何使用

¶引入

¶CDN

你可以使用支持Github回源的CDN

jsDelivr:

1
<script src="https://cdn.jsdelivr.com/gh/OblivionOcean/LightScrollPage@main/index.js"></script>

¶自行部署

点击下载文件

引入:

1
<script src="文件路径"></script>

¶使用

LSP配置了JSDoc,你可以方便的用VSCode、IDEA等代码编辑器查看其使用方法

注:每个页面的长度 = scroll-page总长度 / 页面数量,需要手动设置scroll-page总长度,一般使用vh单位

文档中长度是显示此页面的范围,高度是页面div的高度,一般为100vh

¶自动操作

1
2
3
4
5
6
<div class="scroll-page">


<div class="page"></div>
<div class="page"></div>
</div>

这种状态不能使用 lsp.addEventListener监听,如需监听请手动操作

¶手动操作

1
2
3
4
5
6
<div class="scrollPage">


<div class="page"></div>
<div class="page"></div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const lsp = new ScrollPage(".scrollPage");
lsp.addEventListener((event) => {














})

¶效果

完整效果