hi-ucs/front/public/static/js/rem.js

29 lines
952 B
Vue

/*
* @Author: hisense.wuhongjian
* @Date: 2021-06-15 18:50:17
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-08-12 16:20:45
* @Description: 告诉大家这是什么
*/
;(function (doc, win) {
var docEl = doc.documentElement
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
var recalc = function () {
var clientWidth = docEl.clientWidth
// var clientHeight = docEl.clientHeight
if (!clientWidth) return
/* if ((clientWidth / 19.2) >= 80) {
docEl.style.fontSize = (clientWidth / 19.2) + 'px'
} else {
docEl.style.fontSize = 80 + 'px'
} */
clientWidth > 1920 ? (clientWidth = 1920) : clientWidth
docEl.style.fontSize = clientWidth / 19.2 + 'px'
docEl.style.overflowY = 'auto'
}
if (!doc.addEventListener) return
recalc()
win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)