Source

dom/measureScrollbarWidth.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Source: https://davidwalsh.name/detect-scrollbar-width
 * @category dom
 * @module measureScrollbarWidth
 */
var measureScrollbarWidth = function () {
    // Create the measurement node
    var scrollDiv = document.createElement('div');
    // Way the hell off screen
    scrollDiv.style.top = '-9999';
    scrollDiv.style.overflow = 'scroll';
    scrollDiv.style.position = 'absolute';
    document.body.appendChild(scrollDiv);
    // Get the scrollbar width
    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
    // Delete the DIV
    document.body.removeChild(scrollDiv);
    return scrollbarWidth;
};
exports.default = measureScrollbarWidth;