UNPKG

tdesign-mobile-vue

Version:
43 lines (39 loc) 1.51 kB
/** * tdesign v1.8.3 * (c) 2025 TDesign Group * @license MIT */ import { getIEVersion } from './helper.mjs'; import '../../../_chunks/dep-58437abb.mjs'; import '../../../_chunks/dep-e4a72ad9.mjs'; import '../../../_chunks/dep-496cd097.mjs'; import '../../../_chunks/dep-1c25ba43.mjs'; import '../../../_chunks/dep-d139aa8e.mjs'; import '../../../_chunks/dep-00e3917b.mjs'; import 'lodash-es'; function getScrollbarWidthWithCSS() { var defaultScrollbarWidth = 6; if (typeof navigator === "undefined" || !navigator) return defaultScrollbarWidth; if (/(Chrome|Safari)/i.test(navigator.userAgent)) return defaultScrollbarWidth; var scrollDiv = document.createElement("div"); scrollDiv.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;"; document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); if (/Firefox/.test(navigator.userAgent)) { scrollbarWidth -= 4; } if (getIEVersion() <= 11) { scrollbarWidth = 12; } return scrollbarWidth; } function getScrollbarWidth() { var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body; if (container === document.body) { return window.innerWidth - document.documentElement.clientWidth; } return container.offsetWidth - container.clientWidth; } export { getScrollbarWidth, getScrollbarWidthWithCSS }; //# sourceMappingURL=getScrollbarWidth.mjs.map