You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
38
hyhproject/mobile2/view/default/js/common_xs.js
Executable file
38
hyhproject/mobile2/view/default/js/common_xs.js
Executable file
@ -0,0 +1,38 @@
|
||||
//var num = 1 / window.devicePixelRatio;
|
||||
document.querySelector('meta').setAttribute('name', 'viewport')
|
||||
//document.querySelector('meta').setAttribute('content', 'width=device-width, initial-scale=' + num + ', maximum-scale=' + num + ', minimum-scale=' + num + ', user-scalable=no');
|
||||
document.querySelector('meta').setAttribute('content', 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no');
|
||||
browserRedirect();
|
||||
function browserRedirect(){
|
||||
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
var width = w > h ? h : w;
|
||||
var sUserAgent = navigator.userAgent.toLowerCase();
|
||||
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
||||
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
||||
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
||||
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
||||
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
||||
var bIsAndroid = sUserAgent.match(/android/i) == "android";
|
||||
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
||||
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
||||
var bIsWX = sUserAgent.match(/MicroMessenger/i) == "micromessenger";
|
||||
// document.writeln("您的浏览设备为:");
|
||||
if(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || bIsWX) {
|
||||
width = width;
|
||||
// document.writeln("phone");
|
||||
} else {
|
||||
width = 640;
|
||||
// document.writeln("pc");
|
||||
}
|
||||
var fz = ~~(width * 100000 / 64) / 10000;
|
||||
document.getElementsByTagName("html")[0].style.cssText = 'font-size: ' + fz + "px";
|
||||
var realfz = ~~(+window.getComputedStyle(document.getElementsByTagName("html")[0]).fontSize.replace('px', '') * 10000) / 10000
|
||||
if(fz !== realfz) {
|
||||
document.getElementsByTagName("html")[0].style.cssText = 'font-size:' + fz * (fz / realfz) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
//window.onresize = function(){
|
||||
//browserRedirect();
|
||||
//}
|
Reference in New Issue
Block a user