mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 13:08:23 +08:00
fix(module:modal): the width will be added when there is no scroll bar (#408)
This commit is contained in:
parent
1e02c38d97
commit
20b5bb5e7d
@ -350,6 +350,12 @@ export function removeCls(selector: Element | string, clsName: string | Array<st
|
||||
|
||||
const oldBodyCacheStack = [];
|
||||
|
||||
const hasScrollbar = () => {
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user