diff --git a/components/core/JsInterop/interop.ts b/components/core/JsInterop/interop.ts index af05317f..13aed77e 100644 --- a/components/core/JsInterop/interop.ts +++ b/components/core/JsInterop/interop.ts @@ -350,6 +350,12 @@ export function removeCls(selector: Element | string, clsName: string | Array { + let overflow = document.body.style.overflow; + if (overflow && overflow === "hidden") return false; + return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); +} + export function disableBodyScroll() { let body = document.body; const oldBodyCache = {}; @@ -360,7 +366,7 @@ export function disableBodyScroll() { css(body, { "position": "relative", - "width": "calc(100% - 17px)", + "width": hasScrollbar() ? "calc(100% - 17px)" : null, "overflow": "hidden" }); addCls(document.body, "ant-scrolling-effect");