In the low version of the Android phone browser, if the page is executed quickly, the calculation width will appear incorrectly, the solution is to be executed in the OnLoad method, but this solution in some high-version browser will appear in the page flashing, so use to determine the browser version of the way to solve, That is, the version of the browser using the Document.ready method of execution, other high-version phones do not need to use, of course, to determine the iOS phone, iOS phones do not need to determine
/*rem unit conversion Method Iphone6 Fit */
functionResizeroot () {varDPR = 1, uagent =window.navigator.userAgent;//determine your iOS systemvarIsios = Uagent.match (/iphone/i);//Calculate app WidthvarWwidth = (screen.width > 0)? (window.innerwidth >= Screen.width | | window.innerwidth = 0)?screen.width:window.innerWidth:window.innerWidth, WDPR, wfsize;if(window.devicepixelratio) {WDPR=Window.devicepixelratio;} Else {//identify the iOS resolution methodWDPR = Isios? Wwidth > 818? 3:wwidth > 480? 2:1: 1; }//calculate iOS system widthif(isios) Wwidth =screen.width;wfsize= wwidth > 1080? 144:wwidth/7.5; Window.screenwidth_=Wwidth;//assign value to HTML fontsize valuedocument.getElementsByTagName (' HTML ') [0].DATASET.DPR =WDPR; document.getElementsByTagName (' HTML ') [0].style.fontsize = wfsize + ' px ';}//determine the low version of Android phone browser to execute with the Ready methodfunctionappsion () {uagent=window.navigator.userAgent;varIsios = Uagent.match (/iphone/i);if(Navigator.appVersion.substring (navigator.appversion.length-6) <537 &&!Isios) {Document.ready=function() {resizeroot ();} }Else{resizeroot ();}} Appsion ();//rem Configuration method Execution
HTML5 REM JS Conversion method