scrollbar-size
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i scrollbar-size

    Weekly Downloads

    549

    Version

    2.1.0

    License

    MIT

    Last publish

    Collaborators

    • andrewh
    • olympic