Ali team's HD layout scheme code
The so-called HD solution is based on the device screen DPR (device pixel ratio, also known as dppx, such as dpr=2, indicating that 1 css pixels are composed of 4 physical pixel points)
Dynamically set the font-size of HTML, and adjust the zoom value of the page according to the device DPR, so as to achieve the HD effect * *.
var _basefontsize = Basefontsize | | 100; var _fontscale = Fontscale | | 1; var win = window; var doc = win.document; var ua = navigator.useragent; var matches = Ua.match (/android[\s\s]+applewebkit\/(\d{3})/i); var ucversion = Ua.match (/u3\/(\d+|\.) {5,}) /i); var isuchd = ucversion && parseint (Ucversion[1].split ('. '). Join ('), >= 80; var Isios = Navigator.appVersion.match (/(Iphone|ipad|ipod)/gi); var DPR = Win.devicepixelratio | | 1; if (!isios &&!) ( Matches && matches[1] > 534) &&!isuchd) {//If non-iOS, non-Android4.3, non-UC core, do not perform HD, DPR set is 1; DPR = 1; } var scale = 1/DPR; var Metael = doc.queryselector (' meta[name= "viewport"] "); if (!metael) {Metael = doc.createelement (' meta '); Metael.setattribute (' name ', ' viewport '); Doc.head.appendChild (Metael); } metael.setattribute (' content ', ' width=device-width,user-scalable=no,initial-scale= ' + scale + ', Maximum-scale = ' + scale + ', minimum-scale= ' + scale); Doc.documentElement.style.fontSize = _BASEFONTSIZE/2 * DPR * _fontscale + ' px '; })();
Note: Not all places apply REM width best or percent
Mobile page uses REM layout