-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathscalePage.js
31 lines (31 loc) · 1.03 KB
/
scalePage.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
export default function scalePage() {
if (window.innerHeight > 768 && window.innerWidth > 1366) {
const currentRatio = window.innerHeight / window.innerWidth;
const ratio = 768 / 1366;
if (ratio < currentRatio) {
return {
width: 1366,
height: window.innerHeight * (1366 / window.innerWidth),
transform: `scale(${window.innerWidth / 1366})`
};
} else if (ratio > currentRatio) {
return {
width: window.innerWidth * (768 / window.innerHeight),
height: 768,
transform: `scale(${window.innerHeight / 768})`
};
} else {
return {
width: 1366,
height: 768,
transform: `scale(${window.innerHeight / 768})`
};
};
};
return {
width: window.innerWidth,
height: window.innerHeight,
transform: `scale(1)`,
initial: true
};
};