function renderMeta(){ let width = document.documentElement.clientWidth; let scale = (width / 1300).toFixed(6); let height = document.body.scrollHeight; if (width > 1300 || width < 768) { scale = 1; } if (scale < 1) { let marginLeft = -390 * scale / 2; let marginTop = -height * (1 - scale) / 2; //document.body.setAttribute('style', 'transform:scale(' + scale + ');margin-left:' + (-marginLeft) + 'px;margin-right:' + (-marginLeft) + 'px;transform-origin:top;'); // document.body.setAttribute('style', 'transform:scale(' + scale + ');margin:' + (-marginLeft) + 'px;'); if (navigator.userAgent.indexOf('Firefox') > -1) { //鍙湁鐏嫄鏈 // document.body.setAttribute('style', 'transform:scale(' + scale + ');margin:' + marginTop + 'px ' + marginLeft + 'px;'); } else { document.body.setAttribute('style', 'zoom:' + scale + ';'); } } else { //document.body.setAttribute('style','margin-left:0;margin-right:0;margin-top:0;'); if (navigator.userAgent.indexOf('Firefox') > -1) { //鍙湁鐏嫄鏈 // document.body.setAttribute('style', 'margin-left:0;margin-right:0;margin-top:0;'); } else { document.body.setAttribute('style', 'zoom:1;'); } } } $(window).resize(function(){ renderMeta() }) $(function(){ renderMeta() })