@3dwayfinder/scrollarea 中文文档教程
scrollarea
支持触摸、鼠标和滚轮的 vanilla JS scrollarea
Usage
let area = document.getElementById("scrollarea");
let sa = new ScrollArea(area);
CSS
使容器固定高度,隐藏溢出。 以及根据需要大小的可滚动容器。 要显示滚动条,请添加一些样式
.sa-content-longer .sa-scrollbar {
width: 1em;
background-color: lightblue;
}
.sa-content-longer .sa-bar {
width: 1em;
background-color: antiquewhite;
}
scrollarea
A vanilla JS scrollarea that supports touch, mouse and scrollwheel
Usage
let area = document.getElementById("scrollarea");
let sa = new ScrollArea(area);
CSS
Make the container fixed height, overflow hidden. And the scrollable container as big as needed. To show a scrollbar add some styles to
.sa-content-longer .sa-scrollbar {
width: 1em;
background-color: lightblue;
}
.sa-content-longer .sa-bar {
width: 1em;
background-color: antiquewhite;
}