-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
29 lines (29 loc) · 905 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name="viewport"
content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>elmproject</title>
</head>
<body>
<div id='app'></div>
</body>
<script>
(function (doc, win) { // 这里以苹果6为基准做的
let [docEl, resizeEvt] = [doc.documentElement, 'orientationchange' in window ? 'orientationchange' : 'resize']
let recalc = function () {
let clientWidth = docEl.clientWidth
if (!clientWidth) return
if (clientWidth >= 750) {
docEl.style.fontSize = '100px'
} else {
docEl.style.fontSize = 100 * clientWidth / 750 + 'px'
}
}
if (!doc.addEventListener) return
win.addEventListener(resizeEvt, recalc, false)
doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)
</script>
</html>