Skip to content

Commit b452925

Browse files
committed
获取移动设备最大化大小
1 parent 5d9e73f commit b452925

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

getZoom.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @description 获取移动设备最大化大小
3+
* @author 未知
4+
*/
5+
6+
function getZoom(){
7+
var screenWidth = (Math.abs(window.orientation) === 90) ? Math.max(screen.height, screen.width) : Math.min(screen.height, screen.width);
8+
if(this.isAndroidMobileDevice() && !this.isNewChromeOnAndroid()){
9+
screenWidth = screenWidth/window.devicePixelRatio;
10+
}
11+
var FixViewPortsExperiment = rendererModel.runningExperiments.FixViewport || rendererModel.runningExperiments.fixviewport;
12+
var FixViewPortsExperimentRunning = FixViewPortsExperiment && (FixViewPortsExperiment === "New" || FixViewPortsExperiment === "new");
13+
if(FixViewPortsExperimentRunning){
14+
return screenWidth / window.innerWidth;
15+
}else{
16+
return screenWidth / document.body.offsetWidth;
17+
}
18+
}

0 commit comments

Comments
 (0)