<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>rem</title>
</head>
<body>
</body>
<script>
//同步
window.onload = function() {
if (window.innerWidth<1921) {
loadJs('index.js')
}
function loadJs(src) {
var head = document.getElementsByTagName('head')[0];
var s = document.createElement("script");
s.type = "text/javascript";
s.src = src;
head.appendChild(s);
}
}
$(function () {
//判断是否宽屏
var winWide = window.screen.width;
alert(winWide);
var wideScreen = false;
if (winWide <= 1024) {//1024及以下分辨率
$("#css").attr("href", "pc.css");
} else {
$("#css").attr("href", "mobile.css");
alert('大屏');
wideScreen = true; //是宽屏
}
})
$('#description').on("keyup", function () {
$("#preview_summary").html($(this).val());
});
$(function(){
$('form').submit(function(e){
e.preventDefault();
var data=$(this).serialize();
$("#submit").attr("disabled","true"); //设置变灰按钮
$.ajax({
url:"{jiujin_:U('Complaint/wap_complaint', array('token'=>$_GET['token'], 'wecha_id'=>$_GET['wecha_id']))}",
data:data,
datatype:"json",
method:'post',
success:function(res){
if(res.status){
mui.alert("提交成功!","提示","确定")
}else{
mui.alert("提交失败!","提示","确定")
}
},
error:function(res){
mui.alert("提交失败!请稍后重试","提示","确定")
}
})
setTimeout("$('#submit').removeAttr('disabled')",3000);
})
})
$("#submit").attr("disabled","true");
setTimeout("$('#submit').removeAttr('disabled')",3000);
(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;
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
}
if (docEl.firstElementChild) {
docEl.firstElementChild.appendChild(remStyle);
} else {
var wrap = doc.createElement("div");
wrap.appendChild(remStyle);
doc.write(wrap.innerHTML);
wrap = null;
}
refreshRem();
win.addEventListener("resize", function() {
clearTimeout(tid); //防止执行两次
tid = setTimeout(refreshRem, 300);
}, false);
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);
}
})(640, 1920);
</script>
</body>
</html>
rem
最新推荐文章于 2023-08-28 20:24:08 发布