xz-rkz/xz_screen49/js/rem.js

13 lines
304 B
JavaScript
Raw Permalink Normal View History

2022-07-13 12:22:13 +08:00
function setPage() {
var html = document.getElementsByTagName('html')[0];
var deviceWidth = document.documentElement.clientWidth;
var scale = deviceWidth / 1920;//psd图上的宽度
html.style.fontSize = scale * 100 + 'px';
}
setPage();
window.onresize = function () {
setPage();
}