Socket
Socket
Sign inDemoInstall

wl-scroll-bar

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wl-scroll-bar

滚动条插件


Version published
Weekly downloads
4
increased by33.33%
Maintainers
1
Install size
160 kB
Created
Weekly downloads
 

Readme

Source

滚动条插件

HTML结构说明

<div style="position:relative;">
    <div id="box" style="overflow:hidden;height:200px;">
        1111111111<br>
        2222222222<br>
        3333333333<br>
        ......
    </div>
</div>

调用方式

npm install @stl/scroll-bar

css:  @import "/node_modules/@stl/scroll-bar/dist/index.css";
js:  import { scrollBar } from "@stl/scroll-bar"

let scrollBar = new scrollBar({id:"box"});

参数说明

nametypedefaultdescription
idstring\需要滚动的元素的id**(必填)**
directionstring"y"滚动条滚动方向 默认为竖向滚动条 可选值:"y"(竖向滚动条),"x"(横向滚动条),"xy"(横向竖向都添加)
sizenumber5滚动条的尺寸(竖向滚动条为设置宽度值,横向滚动条为设置高度值)
smallSizenumber20滚动条的最小高度/宽度(竖向滚动条为设置高度值,横向滚动条为设置宽度值),避免因内容过多导致滚动条太小
wheelDisnumber40每次滚动鼠标滚轮滚动的距离
autoRefreshbooleantrue是否自动监听滚动元素内容变化刷新滚动条高度
classNamestring""滚动条需要添加的类名(添加自定义样式时使用)
xMousewheelbooleantrue横向滚动条是否允许滚动鼠标滚轮滚动 只有在direction值为"x"时此参数才有效

方法说明

方法名:      refresh
描述:        刷新滚动条的方法
调用方式:    scrollBar.refresh();

方法名:      fixedPointScroll
描述:        滚动到指定位置
调用方式:    scrollBar.fixedPointScroll(obj);
参数说明:    {left?:number,top?:number}  left:横向滚动条时使用  滚动元素需要滚动到的left值   top:竖向滚动条时使用 滚动元素需要滚动到的top值

Keywords

FAQs

Last updated on 10 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc