From 6b0b681218b2eedbf0e0d7126496f1bd75d5e15d Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Fri, 17 Jun 2022 20:02:03 +0400 Subject: [PATCH] temp --- src/helpers/dom/getScrollPadding.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/helpers/dom/getScrollPadding.ts diff --git a/src/helpers/dom/getScrollPadding.ts b/src/helpers/dom/getScrollPadding.ts new file mode 100644 index 00000000..d31badd5 --- /dev/null +++ b/src/helpers/dom/getScrollPadding.ts @@ -0,0 +1,17 @@ +export default function getScrollPadding() { + const container = document.createElement('div'); + container.classList.add('scrollable', 'scrollable-y'); + container.style.cssText = 'width: 100px; height: 100px; position: absolute; top: -9999px;'; + + const child = document.createElement('div'); + child.style.cssText = 'width: 100%; height: 110px;'; + + container.append(child); + document.body.append(container); + + const diff = container.offsetWidth - child.offsetWidth; + container.remove(); + return diff; +} + +(window as any).testBuggedScroll = getScrollPadding;