UNPKG

781 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8// A change of the browser zoom change the scrollbar size.
9// Credit https://github.com/twbs/bootstrap/blob/3ffe3a5d82f6f561b82ff78d82b32a7d14aed558/js/src/modal.js#L512-L519
10function getScrollbarSize() {
11 var scrollDiv = document.createElement('div');
12 scrollDiv.style.width = '99px';
13 scrollDiv.style.height = '99px';
14 scrollDiv.style.position = 'absolute';
15 scrollDiv.style.top = '-9999px';
16 scrollDiv.style.overflow = 'scroll';
17 document.body.appendChild(scrollDiv);
18 var scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
19 document.body.removeChild(scrollDiv);
20 return scrollbarSize;
21}
22
23var _default = getScrollbarSize;
24exports.default = _default;
\No newline at end of file