bklLiudl
4 天以前 e1afb885a3b4040c15501aedd4b679895ac46be3
1
2
3
4
5
6
7
8
9
10
(function () {
    var html = document.documentElement;
    function onWindowResize() {
        html.style.fontSize = html.getBoundingClientRect().width / 15 + 'px';
    }
    // 750/15=50   1rem=25px
    // 640/16=40   1rem=20px
    window.addEventListener('resize', onWindowResize);
    onWindowResize();
})();