调整
This commit is contained in:
+11
-4
@@ -26,6 +26,7 @@ function setScale() {
|
|||||||
document.body.style.minWidth = '320px';
|
document.body.style.minWidth = '320px';
|
||||||
document.body.style.height = 'auto';
|
document.body.style.height = 'auto';
|
||||||
document.body.style.overflowX = 'hidden';
|
document.body.style.overflowX = 'hidden';
|
||||||
|
document.documentElement.style.height = 'auto';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,13 +39,15 @@ function setScale() {
|
|||||||
|
|
||||||
// 重置样式以获取真实内容高度
|
// 重置样式以获取真实内容高度
|
||||||
document.body.style.transform = 'none';
|
document.body.style.transform = 'none';
|
||||||
|
document.body.style.width = `${DESIGN_WIDTH}px`;
|
||||||
|
document.body.style.minWidth = `${DESIGN_WIDTH}px`;
|
||||||
document.body.style.height = 'auto';
|
document.body.style.height = 'auto';
|
||||||
|
|
||||||
// 获取真实内容高度
|
// 获取真实内容高度(使用 scrollHeight 获取完整内容高度)
|
||||||
const contentHeight = document.body.scrollHeight;
|
const contentHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
||||||
|
|
||||||
// 计算缩放后的高度
|
// 计算缩放后的高度,添加2px余量确保内容完全显示
|
||||||
const scaledHeight = Math.ceil(contentHeight * finalScale);
|
const scaledHeight = Math.ceil(contentHeight * finalScale) + 2;
|
||||||
|
|
||||||
// 应用缩放
|
// 应用缩放
|
||||||
document.body.style.transform = `scale(${finalScale})`;
|
document.body.style.transform = `scale(${finalScale})`;
|
||||||
@@ -54,6 +57,10 @@ function setScale() {
|
|||||||
document.body.style.height = `${scaledHeight}px`;
|
document.body.style.height = `${scaledHeight}px`;
|
||||||
document.body.style.marginLeft = '0px';
|
document.body.style.marginLeft = '0px';
|
||||||
document.body.style.overflowX = 'hidden';
|
document.body.style.overflowX = 'hidden';
|
||||||
|
|
||||||
|
// 不限制 html 元素,让内容自然显示
|
||||||
|
document.documentElement.style.height = '';
|
||||||
|
document.documentElement.style.overflow = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模拟数据 - 小组排名
|
// 模拟数据 - 小组排名
|
||||||
|
|||||||
Reference in New Issue
Block a user