@3dwayfinder/scrollarea
Version:
A vanilla JS scrollarea that supports touch, mouse and scrollwheel
26 lines (20 loc) • 507 B
Markdown
A vanilla JS scrollarea that supports touch, mouse and scrollwheel
```js
let area = document.getElementById("scrollarea");
let sa = new ScrollArea(area);
```
Make the container fixed height, overflow hidden. And the scrollable container as big as needed.
To show a scrollbar add some styles to
```css
.sa-content-longer .sa-scrollbar {
width: 1em;
background-color: lightblue;
}
.sa-content-longer .sa-bar {
width: 1em;
background-color: antiquewhite;
}
```