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

28 lines
917 B
Vue

/*
* @Author: hisense.wuhongjian
* @Date: 2021-06-15 18:50:17
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-06-10 15:45:52
* @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'
}
if (!doc.addEventListener) return
recalc()
win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)