1.1.4 • Published 6 months ago

@itkyk/custom-scrollbar v1.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

#@itkyk/ Custom Scrollbar

Install

$ npm i @itkyk/custom-scrollbar

initialize

import { createScrollbar, ScrollbarOptions } from "@itkyk/custom-scrollbar";

const options: ScrollbarOptions = {
  // ...something
}

const customScrolbar = createScrollbar(".target", options);

Option

keydefaulttypedescription
contsnts".custom-scroll-contents"string or HTMLElementThe 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 HTMLElementThe className of scrollbar
direction"vertical"vertical or horizontalScroll direction. This params contains vertical or horizontal
resizetruebooleanOptimize when resizing.(Scrollbar height calculation and setScrollbarStatus)

methods

methoddescription
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
optionsReturns final ScrollbarOptions information.
elements.targetStores the final target element.
elements.contentsStores the final contents element.
elements.contentsInnerStores the final contentsInner element.
elements.wrapStores the final wrap element.
elements.barStores the final bar element.

Sample code

Sample Site

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago