UNPKG
reblend-ui
Version:
latest (3.0.2)
3.0.2
3.0.0
Utilities for creating robust overlay components
github.com/react-restart/ui
react-restart/ui
reblend-ui
/
src
/
getScrollbarWidth.ts
11 lines
(9 loc)
•
287 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
/** * Get the width of the vertical window scrollbar if it's visible */
export
default
function
getBodyScrollbarWidth
(
ownerDocument =
document
) {
const
window
= ownerDocument.
defaultView
!;
return
Math
.
abs
(
window
.
innerWidth
- ownerDocument.
documentElement
.
clientWidth
, ); }