const baseWidth = 1920;
const baseHeight = 1080;
let timer = null;
let calcScale = function () {
let windowInnerWidth = window.innerWidth;
let windowInnerHeight = window.innerHeight;
// let ratioW = baseWidth / windowInnerWidth;
let ratioW = windowInnerWidth / baseWidth;
// let ratioH = baseHeight / windowInnerHeight;
let ratioH = windowInnerHeight / baseHeight;
console.log(windowInnerWidth, windowInnerHeight)
document.body.style.width = baseWidth + ‘px‘;
document.body.style.height = baseHeight + ‘px‘;
document.body.style.transformOrigin = ‘left top‘;
document.body.style.transform = `scale(${ratioW})`;
}
calcScale();
window.onresize = function () {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(calcScale, 300)
}