diff --git a/common/common.js b/common/common.js index bfa4570..7dc7883 100644 --- a/common/common.js +++ b/common/common.js @@ -237,18 +237,26 @@ $(function () { // }); initFooter(); - const resize = function () { - const width = $(window).width(); - const num = width / 1400; - if (1000 < width && width < 1440) { - $("section").attr( - "style", - "width:1400px;transform: scaleX(" + num + ");transform-origin: 0 0;" - ); - } else { - $("section").attr("style", ""); - } - }; + const resize = function () { + const width = $(window).width(); + const num = width / 1400; + if (1000 < width && width < 1440) { + // 为了避免首页 3D 粒子地球被横向压扁,这里不再对首页 banner 区域做 scaleX,仅对其他 section 生效 + $("section") + .not(".banner") + .each(function () { + this.style.width = "1400px"; + this.style.transform = "scaleX(" + num + ")"; + this.style.transformOrigin = "0 0"; + }); + } else { + $("section").each(function () { + this.style.width = ""; + this.style.transform = ""; + this.style.transformOrigin = ""; + }); + } + }; resize(); window.addEventListener("resize", resize);