123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <meta name="format-detection" content="telephone=no">
- <title>鲸逸到家</title>
- <script>
- // let html = document.documentElement;
- // window.rem = html.getBoundingClientRect().width / 7.5;
- // html.style.fontSize = window.rem + 'px';
- // console.log(window.rem);
- ;(function(win,UP){
- "use strict";
- UP.W=UP.W||{};
- UP.W.Rem=UP.W.Rem||{};
- var timer=null;
- var rem=12;
- var doc=win.document;
- var docEl=doc.documentElement;
- var visualWidth=750;
- var vEl=doc.querySelector('meta[name="visual-width"]');
- if(vEl){
- var vWidth=vEl.getAttribute('width');
- if(vWidth){
- visualWidth=parseInt(vWidth);
- }
- }
- function refreshRem(){
- var width=docEl.getBoundingClientRect().width;
- width=(width>768?visualWidth:width);
- rem = width/(visualWidth/100);
- docEl.style.fontSize=rem+'px';
- }
- win.addEventListener('resize',function(){
- clearTimeout(timer);
- timer=setTimeout(refreshRem,300);
- },false);
- win.addEventListener('pageshow',function(e){
- if(e.persisted){
- clearTimeout(timer);
- timer=setTimeout(refreshRem,300);
- }
- },false);
- if(doc.readyState=='complete'){
- doc.body.style.fontSize='12px';
- }else{
- doc.addEventListener('DOMContentLoader',function(e){
- doc.body.style.fontSize='12px';
- },false);
- }
- refreshRem();
- UP.W.Rem2px=function(d){
- var val=parseFloat(d)*rem;
- if(typeof d=='string' && d.match(/rem$/)){
- val +='px';
- }
- return val;
- };
- UP.W.Rem.px2rem=function(d){
- var val=parseFloat(d)/rem;
- if(typeof d==='string' && d.match(/px$/)){
- val +='rem';
- }
- return val;
- };
- })(window,window.UP||(window.UP={}));
- </script>
- </head>
- <body>
- <div id="app"></div>
- <!-- built files will be auto injected -->
- </body>
- </html>
|