UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

21 lines (19 loc) 729 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getScrollbarSize; // A change of the browser zoom change the scrollbar size. // Credit https://github.com/twbs/bootstrap/blob/3ffe3a5d82f6f561b82ff78d82b32a7d14aed558/js/src/modal.js#L512-L519 function getScrollbarSize() { var scrollDiv = document.createElement('div'); scrollDiv.style.width = '99px'; scrollDiv.style.height = '99px'; scrollDiv.style.position = 'absolute'; scrollDiv.style.top = '-9999px'; scrollDiv.style.overflow = 'scroll'; document.body.appendChild(scrollDiv); var scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); return scrollbarSize; }