scrollbar-size
v2.1.0
Published
Find the size of a scrollbar in the browser.
Downloads
3,075
Readme
scrollbar-size
Installation
npm install --save scrollbar-size
Usage
import scrollbarSize from "scrollbar-size"
const sizeOfScrollbar: number = scrollbarSize();
console.log(sizeOfScrollbar); // usually ~20
Notes
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.
Credits
Thanks to olmokramer for the initial implementation
Issues
If you have any issues, you can file an issue on the github page.
License
scrollbar-size is licensed under the MIT license.