scrollbar-size
Version:
Find the size of a scrollbar in the browser.
41 lines (24 loc) • 984 B
Markdown
```
npm install --save scrollbar-size
```
```typescript
import scrollbarSize from "scrollbar-size"
const sizeOfScrollbar: number = scrollbarSize();
console.log(sizeOfScrollbar); // usually ~20
```
The function will return undefined if it is called before the document is ready.
The size of the scrollbar is only calculated the first time the function is
called. If your platform has scrollbars that resize, this module will not work
for you.
Thanks to [olmokramer](https://github.com/olmokramer/) for the initial
implementation
If you have any issues, you can file an issue on the
[](https://github.com/olympicsoftware/scrollbar-size/issues).
scrollbar-size is licensed under the [MIT license](LICENSE).