1.1.4 • Published 2 years ago
@itkyk/custom-scrollbar v1.1.4
#@itkyk/ Custom Scrollbar
Install
$ npm i @itkyk/custom-scrollbarinitialize
import { createScrollbar, ScrollbarOptions } from "@itkyk/custom-scrollbar";
const options: ScrollbarOptions = {
// ...something
}
const customScrolbar = createScrollbar(".target", options);Option
| key | default | type | description |
|---|---|---|---|
| contsnts | ".custom-scroll-contents" | string or HTMLElement | The className of dom given overflow: scroll or overflow: auto |
| barWrap | ".custom-scroll-wrap" | string or HTMLElement | The className of the wrap in the range of motion of the scrollbar |
| bar | ".custom-scroll-bar" | string or HTMLElement | The className of scrollbar |
| direction | "vertical" | vertical or horizontal | Scroll direction. This params contains vertical or horizontal |
| resize | true | boolean | Optimize when resizing.(Scrollbar height calculation and setScrollbarStatus) |
methods
| method | description |
|---|---|
| destroy() | Return to initial state and remove all EventListener. |
| reload() | Initialize again. |
| isNeedScrollbar() | Returns a boolean whether a scroll bar is required. |
| setScrollbarStatus() | If you do not need a scrollbar, add disable-scrollbar to the wrap Element class.Remove it if necessary. |
| getBarSize() | Get the size of the scroll bar in px units. If "vertical", then get height, but if "horizontal", then get width |
| options | Returns final ScrollbarOptions information. |
| elements.target | Stores the final target element. |
| elements.contents | Stores the final contents element. |
| elements.contentsInner | Stores the final contentsInner element. |
| elements.wrap | Stores the final wrap element. |
| elements.bar | Stores the final bar element. |
Sample code
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago