All Projects → xobotyi → scrollbar-width

xobotyi / scrollbar-width

Licence: MIT License
Lightweight tool to get browser's scrollbars width of any browser.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to scrollbar-width

dicom-dimse-native
node js native addon for dimse services
Stars: ✭ 33 (+32%)
Mutual labels:  native
native-xr-for-web
Add iOS and Android build with AR capabilities to your website or web-based app.
Stars: ✭ 27 (+8%)
Mutual labels:  native
ImageCropper
✂️ Detect and crop faces, barcodes, texts or rectangle in image with iOS 11 Vision (iOS 10 Core Image) api.(图片裁剪:支持人脸、二维码/条形码、文本、方框)
Stars: ✭ 17 (-32%)
Mutual labels:  detect
Multiplatform-LiveData
Multiplatorm implementation of LiveDatas / MVVM in kotlin android & native ios
Stars: ✭ 95 (+280%)
Mutual labels:  native
netty-native-demo
Instant Netty startup using GraalVM's Native Image Generation
Stars: ✭ 58 (+132%)
Mutual labels:  native
xDL
🔥 xDL is an enhanced implementation of the Android DL series functions.
Stars: ✭ 117 (+368%)
Mutual labels:  native
auth0-ios-swift-sample
Auth0 Integration Samples for iOS Swift
Stars: ✭ 55 (+120%)
Mutual labels:  native
AppRopio.Mobile
AppRopio - mobile apps builder for iOS/Android based on Xamarin
Stars: ✭ 16 (-36%)
Mutual labels:  native
vue-scrolly
Overlay scrollbar for Vue.js.
Stars: ✭ 24 (-4%)
Mutual labels:  scrollbar
CleanUnwantedUpdates
A set of scripts to detect updates of Microsoft (TM) Windows (TM) OS which harm users' privacy and uninstall them
Stars: ✭ 24 (-4%)
Mutual labels:  detect
titanium-arkit
Use the iOS 11 ARKit API in Axway Titanium
Stars: ✭ 28 (+12%)
Mutual labels:  native
windigo
Windows API and GUI in idiomatic Go.
Stars: ✭ 187 (+648%)
Mutual labels:  native
hms-safetydetect-demo-android
SafetyDetect Sample provides many sample programs for your reference or usage.This example demonstrates how to integrate services provided by Safetydetect Kit, such as APPchecks, URLcheck, Userdetect, Wifidetect.
Stars: ✭ 16 (-36%)
Mutual labels:  detect
IPC.Bond
IPC.Bond is an extension of IPC library that provides inter-process communication using shared memory on Windows with Bond serialization.
Stars: ✭ 26 (+4%)
Mutual labels:  native
PointerScript
Scripting language with pointers and native library access.
Stars: ✭ 26 (+4%)
Mutual labels:  native
tasit-sdk
A JavaScript / TypeScript SDK for making native mobile Ethereum dapps using React Native
Stars: ✭ 93 (+272%)
Mutual labels:  native
phpmon
Lightweight, native Mac menu bar app that interacts with Laravel Valet. Helps you manage multiple PHP installations, locate config files and more.
Stars: ✭ 1,896 (+7484%)
Mutual labels:  native
ts-llvm
TypeScript to LLVM compiler (abandoned)
Stars: ✭ 266 (+964%)
Mutual labels:  native
react-native-dimension
A React Native Dimension for Responsive Layout
Stars: ✭ 31 (+24%)
Mutual labels:  width
react-tinder-card
A npm react module for making react elements swipeable like in the dating app tinder.
Stars: ✭ 184 (+636%)
Mutual labels:  native

@xobotyi/scrollbar-width

A tool to get browser's scrollbars width.

Build status NPM version NPM weekly downloads License Types definition Codacy Code Grade Tests LOC

× LIVE EXAMPLE ×


❤️Please consider starring this project to show your love and support.🙌

Installation

npm install @xobotyi/scrollbar-width
# or via yarn
yarn add @xobotyi/scrollbar-width

INSTALLATION NOTE:
This lib is written in TypeScript and delivered with both, transpiled and untranspiled ES versions:

  • main field of package.json is pointing to transpiled ES5-compatible version with CJS modules resolution;
  • module field is pointing to transpiled ES5-compatible version with ES modules resolution;
  • esnext field is pointing to the ESnext version with ES modules resolution;

OR
you can add it directly to your site via the <script /> with help of UNPKG:

<script src="https://unpkg.com/@xobotyi/scrollbar-width/dist/index.min.js"/>

After that you will be able to use the function as xobotyi.scrollbarWidth()

Usage

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

scrollbarWidth(); // for most browsers will return 17 and 0 for SSR environment
// or undefined if to call it too early [read below]

This function caches the value to avoid increased resources usage. In case you want to get re-calculated value - pass true as first call parameter.

NOTE:
Function will return undefined in case being called before the DOM is ready.

One more clarification

This function has inner cache due to scrollbars width is not intended to be changed since initial call, but it can in case you toggle the device emulation.
If you need function to recalculate the width call it with true parameter and get new value or set scrollbarWidth.__cache to undefined and next call will return the fresh value.

Related projects

  • react-scrollbars-custom — The best React custom scrollbars component. Allows you to customise scrollbars as you like it, crossbrowser!
  • zoom-level — A comprehensive cross-browser package that allow you to determine page's and element's zoom level.
  • @xobotyi/should-reverse-rtl-scroll — A tool detecting if RTL scroll value should be negative.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].