Socket
Socket
Sign inDemoInstall

@xobotyi/scrollbar-width

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xobotyi/scrollbar-width

A tool to get browser's scrollbars width.


Version published
Weekly downloads
1.5M
decreased by-3.12%
Maintainers
1
Weekly downloads
 
Created

What is @xobotyi/scrollbar-width?

The @xobotyi/scrollbar-width package is a small, dependency-free utility for measuring the width of the browser's scrollbar. It is useful for accurately calculating layout dimensions when scrollbars might affect the overall width of containers, particularly in responsive designs or complex layouts.

What are @xobotyi/scrollbar-width's main functionalities?

Get scrollbar width

This feature allows you to measure the width of the scrollbar. The function returns the width in pixels as a number. If the scrollbar is not present, it returns 0. This is useful for adjusting layout dimensions dynamically based on the presence of scrollbars.

import scrollbarWidth from '@xobotyi/scrollbar-width';

const width = scrollbarWidth();
console.log(`Scrollbar width is ${width}px`);

Re-measure scrollbar width

This feature forces a re-measurement of the scrollbar width. This can be useful when the document or window has changed significantly (e.g., after dynamically loading content) and you need to ensure the measurement is still accurate.

import { scrollbarWidth } from '@xobotyi/scrollbar-width';

const width = scrollbarWidth(true);
console.log(`Re-measured scrollbar width is ${width}px`);

Other packages similar to @xobotyi/scrollbar-width

Keywords

FAQs

Package last updated on 24 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc