perf(utils): optimize page blank space setting

This commit is contained in:
XPoet 2021-12-04 17:43:31 +08:00
parent cb12c6b864
commit 7406b65bd2
1 changed files with 4 additions and 1 deletions

View File

@ -197,7 +197,10 @@ KEEP.initUtils = () => {
const innerHeight = window.innerHeight; const innerHeight = window.innerHeight;
const pb_dom = document.querySelector('.page-main-content-bottom'); const pb_dom = document.querySelector('.page-main-content-bottom');
if (allDomHeight < innerHeight) { if (allDomHeight < innerHeight) {
pb_dom.style.marginTop = Math.floor(innerHeight - allDomHeight) + 'px'; const marginTopValue = Math.floor(innerHeight - allDomHeight);
if (marginTopValue > 0) {
pb_dom.style.marginTop = `${marginTopValue - 2}px`;
}
} }
}, },