出現(xiàn)如下圖 :? ?一屏幕顯示不完??
<script>
?/**
? ? * 根據(jù)屏幕尺寸,調(diào)整文案大小
? ? */
? ? initPageScale();
? ? function initPageScale() {
? ? ? ? var width = document.documentElement.clientWidth;
? ? ? ? var height = document.documentElement.clientHeight;
? ? ? ? //設(shè)置一個(gè)最小值,防止當(dāng)瀏覽器里有top和bottom條時(shí)候,縮放比例太小
? ? ? ? if (height < 520) {? ? ? ? ? ? //height = 520;
? ? ? ? }
? ? ? ? var ratio = 1;
? ? ? ? var clientRatio = height / width;
? ? ? ? var standardRatio = 1325 / 750; //視覺(jué)基準(zhǔn)
? ? ? ? if (clientRatio < standardRatio) { //扁屏幕要進(jìn)行縮放處理
? ? ? ? ? ? ratio = clientRatio / standardRatio;
}
? ? ? ? // var docuW = document.documentElement.clientWidth,
//? ? abc = docuW / 750 * ratio;
// document.getElementsByTagName('html')[0].style.fontSize = abc * 100 + 'px';
// document.getElementsByTagName('html')[0].style.fontSize = (document.documentElement.clientWidth / 750) * 100 + "px";
? ? ? ? document.getElementsByTagName('html')[0].style.fontSize= (document.documentElement.clientWidth/ 750 * ratio) * 100 + "px";
}
</script>
