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

推荐订阅源

SecWiki News
SecWiki News
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Last Watchdog
The Last Watchdog
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Help Net Security
Attack and Defense Labs
Attack and Defense Labs
O
OpenAI News
博客园 - 聂微东
Y
Y Combinator Blog
N
News | PayPal Newsroom
IT之家
IT之家
C
Cybersecurity and Infrastructure Security Agency CISA
Engineering at Meta
Engineering at Meta
L
LangChain Blog
L
Lohrmann on Cybersecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
C
CERT Recently Published Vulnerability Notes
爱范儿
爱范儿
P
Palo Alto Networks Blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
G
Google Developers Blog
PCI Perspectives
PCI Perspectives
The Register - Security
The Register - Security
H
Heimdal Security Blog
V
Visual Studio Blog
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
TaoSecurity Blog
TaoSecurity Blog
博客园 - Franky
T
The Blog of Author Tim Ferriss
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 叶小钗
The Hacker News
The Hacker News
U
Unit 42
Security Latest
Security Latest
The GitHub Blog
The GitHub Blog

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) => {














})

¶效果

完整效果