Skip to content

Commit 44aec96

Browse files
committed
获取移动设备初始化大小
1 parent a1327de commit 44aec96

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

getInitZoom.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @description 获取移动设备初始化大小
3+
* @author 未知
4+
*/
5+
6+
function getInitZoom(){
7+
if(!this._initZoom){
8+
var screenWidth = Math.min(screen.height, screen.width);
9+
if(this.isAndroidMobileDevice() && !this.isNewChromeOnAndroid()){
10+
screenWidth = screenWidth/window.devicePixelRatio;
11+
}
12+
this._initZoom = screenWidth /document.body.offsetWidth;
13+
}
14+
return this._initZoom;
15+
}

0 commit comments

Comments
 (0)