0.0.1 • Published 2 years ago

@humandetail/scroller v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Scroller

📦 Install

Install with npm:

npm i @humandetail/scroller

Install with yarn:

yarn add @humandetail/scroller

🦄 Usage

import Scroller from '@humandetail/scroller'

const scroller = new Scroller('.content', {
  height: '500px'
})

📖 Params

参数类型初始值说明
wheelStepnumber20应用于每个鼠标滚轮步骤的滚动量
widthstringauto容器的宽度
heightstring100vh容器的高度
scrollbarWidthnumber10滚动条的宽度
buttonSizenumber10滚动条按钮的尺寸
trackWidthnumber10滚动条轨道的宽度
thumbWidthnumber10滚动条滑块的宽度
resizebooleantrue是否监听窗口的 resize 事件
observebooleantrue是否监听 DOM 变化
reachOffsetobject{ top: number; right: number; bottom: number; left: number; }触底/触顶偏移量
buttonbooleantrue是否需要上下按钮
stylesobject{ bar?: Partial<CSSStyleDeclaration>; button?: Partial<CSSStyleDeclaration>; track?: Partial<CSSStyleDeclaration>; thumb?: Partial<CSSStyleDeclaration>; }滚动条样式

📄 License

MIT License © 2019-PRESENT Humandetail