A library adding "native" scrolling behavior to any HTML element (textareas, divs, etc.) Inertial scrolling on touch devices is also supported by default
Please see the exa,ples, they are quite self-explanatory.
Some hints:
- You have to initialize the containers explicitly in your code somewhere, e.g. on page load.
- CSS ctyling is up to you, you can find all class names in the examples
- You can use
scrollLeft
,scrollTop
,scrollWidth
andscrollHeight
as it would be a native scroll - When there is little content the scrollbars will disappear and then come back when necessary thanks to the DOM modification watching
- Everything about sizing and behavior is controlled via attributes. The most useful are:
Attribute | Description |
---|---|
scroll-size | the width of the scrollbar |
button-size | the width of the buttons along the scroll axis |
thumb-length | the width of the thumb along the scroll axis |
thumb-width | the width of the thumb along the cross-axis (the thumb can be narrower or wider than the scrollbar) |
scroll-delta | one mouse wheel tick will scroll the contents by this amount of pixels |
viewport-width | the width of the viewport |
viewport-height | the height of the viewport |
xscroll-allow-async | allow delayed initialization for more accurate container's width calculation |
content-offset | the offset from the edge of content to the edge of the container (default 0) |