Skip to content

Instantly share code, notes, and snippets.

@ClausClaus
Last active January 28, 2019 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClausClaus/d159efb58b0429c67c7352679054d1f2 to your computer and use it in GitHub Desktop.
Save ClausClaus/d159efb58b0429c67c7352679054d1f2 to your computer and use it in GitHub Desktop.
rerm设置
(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