Last active
January 28, 2019 01:23
-
-
Save ClausClaus/d159efb58b0429c67c7352679054d1f2 to your computer and use it in GitHub Desktop.
rerm设置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (doc, win) { | |
var docEl = doc.documentElement | |
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize' | |
function recalc() { | |
var designWidth = 750 | |
var clientWidth = docEl.clientWidth | |
if (!clientWidth || clientWidth > designWidth) return | |
docEl.style.fontSize = (100 * clientWidth / designWidth) + 'px' | |
} | |
if (!doc.addEventListener) return | |
win.addEventListener(resizeEvt, recalc, false) | |
doc.addEventListener('DOMContentLoaded', recalc, false) | |
})(document, window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment