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

推荐订阅源

The Cloudflare Blog
T
Tenable Blog
V
Vulnerabilities – Threatpost
T
Troy Hunt's Blog
SecWiki News
SecWiki News
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Secure Thoughts
Cyberwarzone
Cyberwarzone
A
Arctic Wolf
H
Heimdal Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
N
News and Events Feed by Topic
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cisco Talos Blog
Cisco Talos Blog
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
T
Tor Project blog
WordPress大学
WordPress大学
AWS News Blog
AWS News Blog
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
Cloudbric
Cloudbric
O
OpenAI News
U
Unit 42
Google DeepMind News
Google DeepMind News
Simon Willison's Weblog
Simon Willison's Weblog
Recorded Future
Recorded Future
N
News | PayPal Newsroom
S
Schneier on Security
F
Full Disclosure
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
P
Privacy International News Feed
L
LINUX DO - 最新话题
F
Fortinet All Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements

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














})

¶效果

完整效果