【文件属性】:
文件名称:scroll-spy:滚动事件的Javascript库
文件大小:33KB
文件格式:ZIP
更新时间:2021-05-05 04:18:21
javascript npm JavaScript
滚动间谍
用于订阅在浏览器中滚动事件的库。 在一个requestAnimationFrame中运行所有事件。
安装
$ npm install @earthpeople/scroll-spy
或者
$ yarn add @earthpeople/scroll-spy
用法
// some-component.js
import { startScrollSpy } from "@earthpeople/scroll-spy" ;
const subscribe = startScrollSpy ( ) ;
let scrolledPast100 = false ;
subscribe ( "scroll" , event => {
if ( event . scrollTop > 100 ) {
scrolledPast100 = true ;
}
} ) ;
star
【文件预览】:
scroll-spy-master
----.gitignore(23B)
----package.json(864B)
----package-lock.json(116KB)
----LICENSE(1KB)
----index.js(31B)
----README.md(4KB)
----es5()
--------index.js(8KB)
--------events.js(345B)
----lib()
--------index.js(6KB)
--------events.js(205B)
----docs()
--------examples.js(74B)
--------index.html(314B)