Files
screen-huahong/src/config/rem.js
2024-02-19 17:27:25 +08:00

14 lines
606 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function (doc, win) {
var docEl = doc.documentElement
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
var recalc = function () {
var clientWidth = docEl.clientWidth
if (!clientWidth) return
docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px'
document.body.style.display = 'block'
}
if (!doc.addEventListener) return win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)
// 晟华大屏尺寸2560*1440屏幕太大用rem样式会错乱现在使用px、%