1.0.2 • Published 2 years ago
@yik_l/scroll v1.0.2
yik-scroll
介绍
滚动条监听
软件架构
软件架构说明
安装教程
npm i @yik_l/scroll -S
yarn add @yik_l/scroll -S
使用说明
import Scroll from "@yik_l/scroll";
let scroll = new Scroll({
el: "#test", //需要监听得元素
//置顶时,回调
watchTop: () => {
console.log("置顶");
},
//最低时,回调
watchBottom: () => {
console.log("最低");
},
//滚动时,回调 返回 当前滚动值、最大滚动值、滚动方向
watch: ({ top, height, direction }) => {
console.log(top, height, direction);
},
});
// 设置滚动条位置
scroll.setTop(400);