NuclearDispersionSystem/ant-design-vue-jeecg/node_modules/ant-design-vue/es/_util/switchScrollingEffect.js
2023-09-14 14:47:11 +08:00

18 lines
595 B
Java

import getScrollBarSize from './getScrollBarSize';
export default (function (close) {
var bodyIsOverflowing = document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
if (!bodyIsOverflowing) {
return;
}
if (close) {
document.body.style.position = '';
document.body.style.width = '';
return;
}
var scrollBarSize = getScrollBarSize();
if (scrollBarSize) {
document.body.style.position = 'relative';
document.body.style.width = 'calc(100% - ' + scrollBarSize + 'px)';
}
});