falvpingtai/public/index.html

98 lines
3.2 KiB
HTML
Raw Normal View History

2019-11-25 08:27:57 +08:00
<!DOCTYPE html>
<html lang="en">
2019-11-26 11:00:46 +08:00
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
2019-12-05 14:23:51 +08:00
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
2019-11-26 11:00:46 +08:00
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="./normalize.css">
2019-12-05 14:23:51 +08:00
<script>
window.onload=function () {
document.addEventListener('touchstart',function (event) {
if(event.touches.length>1){
event.preventDefault();
}
});
var lastTouchEnd=0;
document.addEventListener('touchend',function (event) {
var now=(new Date()).getTime();
if(now-lastTouchEnd<=300){
event.preventDefault();
}
lastTouchEnd=now;
},false);
document.addEventListener('gesturestart', function (event) {
event.preventDefault();
});
}
</script>
2019-11-26 11:00:46 +08:00
<script>
//designWidth:设计稿的实际宽度值,需要根据实际设置
//maxWidth:制作稿的最大宽度值,需要根据实际设置
//这段js的最后面有两个参数记得要设置一个为设计稿实际宽度一个为制作稿最大宽度例如设计稿为750最大宽度为750则为(750,750)
; (function (designWidth, maxWidth) {
var doc = document,
win = window,
docEl = doc.documentElement,
remStyle = document.createElement("style"),
tid;
function refreshRem() {
var width = docEl.getBoundingClientRect().width;
maxWidth = maxWidth || 540;
width > maxWidth && (width = maxWidth);
var rem = width * 100 / designWidth;
2019-12-05 14:23:51 +08:00
// alert(rem)
remStyle.innerHTML = 'html{font-size:' + Math.floor(rem) + 'px;}';
// alert(window.getComputedStyle(window.document.documentElement)["fontSize"])
2019-11-25 09:07:42 +08:00
}
2019-11-26 11:00:46 +08:00
if (docEl.firstElementChild) {
docEl.firstElementChild.appendChild(remStyle);
} else {
var wrap = doc.createElement("div");
wrap.appendChild(remStyle);
doc.write(wrap.innerHTML);
wrap = null;
}
//要等 wiewport 设置好后才能执行 refreshRem不然 refreshRem 会执行2次
refreshRem();
win.addEventListener("resize", function () {
clearTimeout(tid); //防止执行两次
tid = setTimeout(refreshRem, 300);
2019-11-25 09:07:42 +08:00
}, false);
2019-11-26 11:00:46 +08:00
win.addEventListener("pageshow", function (e) {
if (e.persisted) { // 浏览器后退的时候重新计算
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}
}, false);
if (doc.readyState === "complete") {
doc.body.style.fontSize = "16px";
} else {
doc.addEventListener("DOMContentLoaded", function (e) {
doc.body.style.fontSize = "16px";
}, false);
}
})(750, 1024);
</script>
<script src="./jquery-3.4.1.min.js"></script>
2019-12-19 09:12:50 +08:00
<title>Lawpro社区</title>
2019-11-26 11:00:46 +08:00
</head>
<body>
<noscript>
<strong>We're sorry but falv doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>