-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPalletSize.js
54 lines (45 loc) · 1.31 KB
/
PalletSize.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var browserNum = 0;
var functionArr = [getBrowserWindowSizeInit,
getBrowserWindowSize1,getBrowserWindowSize2,
getBrowserWindowSize3,getBrowserWindowSize4];
function getSize() {
//document.getElementById("pallet_info").innerHTML = browserNum;
return functionArr[browserNum]();
}
function getBrowserWindowSize1() {
return {width:document.body.offsetWidth,
height:document.body.offsetHeight};
}
function getBrowserWindowSize2() {
return {width:document.documentElement.offsetWidth,
height:document.documentElement.offsetHeight};
}
function getBrowserWindowSize3() {
return {width:window.innerWidth,
height:window.innerHeight};
}
function getBrowserWindowSize4() {
return {width:630,height:460};
}
function getBrowserWindowSizeInit() {
var winW = 630, winH = 460;
browserNum = 4;
if (document.body && document.body.offsetWidth) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
browserNum = 1;
}
if (document.compatMode=='CSS1Compat' &&
document.documentElement &&
document.documentElement.offsetWidth ) {
winW = document.documentElement.offsetWidth;
winH = document.documentElement.offsetHeight;
browserNum = 2;
}
if (window.innerWidth && window.innerHeight) {
winW = window.innerWidth;
winH = window.innerHeight;
browserNum = 3;
}
return {width:winW,height:winH};
}