let _rem;
function remAdaptation() {
var d = document.documentElement;
var cw = d.clientWidth;
_rem = d.style.fontSize = 16 * (cw / 375)
d.style.fontSize = _rem + 'px'
}
window.addEventListener(('orientationchange' in window ? 'orientationchange' : 'resize'), remAdaptation, false);
remAdaptation();
rem适配 自适应不同尺寸屏幕
最新推荐文章于 2022-10-09 08:43:46 发布