移动端自适应js

let resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
let recalc = function () {
  document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px'
}
window.addEventListener(resizeEvt, recalc, false)
document.addEventListener('DOMContentLoaded', recalc, false)

猜你喜欢

转载自www.cnblogs.com/luov/p/9330880.html

相关文章