Commit 69ba8ff0 authored by Mac's avatar Mac

兼容rem的新js

parent 9d189550
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
<div class="barrage"> <div class="barrage">
<div class="bar_input"> <div class="bar_input">
<input type="text" placeholder="发弹幕参与大屏互动"> <input type="text" placeholder="发弹幕参与大屏互动(限20字数)" maxlength="20">
</div> </div>
<div class="send_btn" onclick="sendMsg(1)"> <div class="send_btn" onclick="sendMsg(1)">
<p>发送</p> <p>发送</p>
...@@ -190,6 +190,8 @@ ...@@ -190,6 +190,8 @@
} }
function getMsg() { function getMsg() {
//年会首页菜单 //年会首页菜单
...@@ -245,7 +247,7 @@ ...@@ -245,7 +247,7 @@
}); });
//嘉宾数量 //嘉宾数量
proxy.on('updateUsersOnlineCount',function (data) { proxy.on('updateUSERSOnlineCount',function (data) {
$(".rNumber").html(data) $(".rNumber").html(data)
}) })
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="top"> <div class="top">
<div class="top_title"> <div class="top_title">
<img src="../../images/aM/home.png" alt="" class="return"> <img src="../../images/aM/home.png" alt="" class="return">
<p>打老鼠</p> <p>瑞鼠迎福</p>
<img src="../../images/aM/ranging.png" alt="" class="ranging"> <img src="../../images/aM/ranging.png" alt="" class="ranging">
</div> </div>
<div class="top_data"> <div class="top_data">
......
...@@ -141,6 +141,10 @@ ...@@ -141,6 +141,10 @@
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.copy2{
width: 0.65rem;
height: 0.23rem;
}
.box_r p{ .box_r p{
color: #B31D2E; color: #B31D2E;
font-size: 0.1rem; font-size: 0.1rem;
...@@ -236,7 +240,7 @@ ...@@ -236,7 +240,7 @@
' <span>来源:'+Password+'</span>\n' + ' <span>来源:'+Password+'</span>\n' +
' </div>\n' + ' </div>\n' +
' <div class="box_r">\n' + ' <div class="box_r">\n' +
// ' <div class="copy" onclick="copy(\''+source+'\',)" data-clipboard-action="copy" data-clipboard-target="#tokenReadPackage"></div>\n' + ' <div class="copy2"></div>\n' +
' <p>'+list[i].c+'</p>\n' + ' <p>'+list[i].c+'</p>\n' +
' </div>\n' + ' </div>\n' +
' </div>' ' </div>'
......
/** /**
* Created by lovo_bdk on 15-12-17. * Created by lovo_bdk on 15-12-17.
*/ */
!(function(win, doc){ // !(function(win, doc){
function setFontSize() { // function setFontSize() {
// 获取window 宽度 // // 获取window 宽度
// zepto实现 $(window).width()就是这么干的 // // zepto实现 $(window).width()就是这么干的
var winWidth = window.innerWidth; // var winWidth = window.innerWidth;
doc.documentElement.style.fontSize = (winWidth / 375) * 100 + 'px' ; // doc.documentElement.style.fontSize = (winWidth / 375) * 100 + 'px' ;
//设置页面元素根元素的px大小,然后所有rem以此为基准。 // //设置页面元素根元素的px大小,然后所有rem以此为基准。
//640为开发时候的页面宽度,20为基准px大小, 可以设置任意数字,方便开发时候rem计算 // //640为开发时候的页面宽度,20为基准px大小, 可以设置任意数字,方便开发时候rem计算
//
// }
//
// var evt = 'onorientationchange' in win ? 'orientationchange' : 'resize';
//
// var timer = null;
//
// win.addEventListener(evt, function () {
// clearTimeout(timer);
//
// timer = setTimeout(setFontSize, 300);
// }, false);
//
// win.addEventListener("pageshow", function(e) {
// if (e.persisted) {
// clearTimeout(timer);
//
// timer = setTimeout(setFontSize, 300);
// }
// }, false);
//
// //初始化
// setFontSize();
//
// }(window, document));
(function(win) {
var docEl = win.document.documentElement,
tid;
function refreshRem() {
var width = docEl.getBoundingClientRect().width;
var rem = width / 375*100;//以750px为原稿,除以100可得各元素的rem
docEl.style.fontSize = rem + "px";
var actualSize = parseFloat(window.getComputedStyle(docEl)["font-size"]);
if (actualSize !== rem) {
var remScaled = rem / ( actualSize / rem );
docEl.style.fontSize = remScaled + "px"
}
} }
var evt = 'onorientationchange' in win ? 'orientationchange' : 'resize'; function dbcRefresh() {
clearTimeout(tid);
var timer = null; tid = setTimeout(refreshRem, 100)
}
win.addEventListener(evt, function () {
clearTimeout(timer);
timer = setTimeout(setFontSize, 300);
}, false);
win.addEventListener("resize", function() { dbcRefresh() }, false);
win.addEventListener("pageshow", function(e) { win.addEventListener("pageshow", function(e) {
if (e.persisted) { if (e.persisted) { dbcRefresh() }
clearTimeout(timer);
timer = setTimeout(setFontSize, 300);
}
}, false); }, false);
refreshRem();
//初始化 })(window);
setFontSize();
}(window, document));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment