-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.js
63 lines (56 loc) · 2.5 KB
/
script.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
55
56
57
58
59
60
61
62
63
var btn1 = document.getElementById("btn-1");
var btn2 = document.getElementById("btn-2");
var btn3 = document.getElementById("btn-3");
var btn4 = document.getElementById("btn-4");
window.onload = function(){
document.getElementById('name').innerHTML = "Welcome, " + localStorage.getItem("name");
resizeButtons()
};
function resizeButtons(){
btn1.style.width = window.innerWidth/5 + "px";
btn1.style.height = window.innerWidth/5 + "px";
btn2.style.width = window.innerWidth/5 + "px";
btn2.style.height = window.innerWidth/5 + "px";
btn3.style.width = window.innerWidth/5 + "px";
btn3.style.height = window.innerWidth/5 + "px";
btn4.style.width = window.innerWidth/5 + "px";
btn4.style.height = window.innerWidth/5 + "px";
btn1.style.marginLeft = window.innerWidth/50 + "px";
btn1.style.marginRight = window.innerWidth/50 + "px";
btn2.style.marginLeft = window.innerWidth/50 + "px";
btn2.style.marginRight = window.innerWidth/50 + "px";
btn3.style.marginLeft = window.innerWidth/50 + "px";
btn3.style.marginRight = window.innerWidth/50 + "px";
btn4.style.marginLeft = window.innerWidth/50 + "px";
btn4.style.marginRight = window.innerWidth/50 + "px";
if(screen.width<600){
btn1.style.width = window.innerWidth/3 + "px";
btn1.style.height = window.innerWidth/3 + "px";
btn2.style.width = window.innerWidth/3 + "px";
btn2.style.height = window.innerWidth/3 + "px";
btn3.style.width = window.innerWidth/3 + "px";
btn3.style.height = window.innerWidth/3 + "px";
btn4.style.width = window.innerWidth/3 + "px";
btn4.style.height = window.innerWidth/3 + "px";
btn1.style.backgroundColor = "inherit";
btn1.style.color = "white";
btn2.style.backgroundColor = "inherit";
btn2.style.color = "white";
btn3.style.backgroundColor = "inherit";
btn3.style.color = "white";
btn4.style.backgroundColor = "inherit";
btn4.style.color = "white";
btn1.style.marginBottom = window.innerWidth/50 + "px";
btn1.style.marginRight = window.innerWidth/30 + "px";
btn2.style.marginLeft = window.innerWidth/30 + "px";
btn2.style.marginBottom = window.innerWidth/50 + "px";
btn3.style.marginTop = window.innerWidth/50 + "px";
btn3.style.marginRight = window.innerWidth/30 + "px";
btn4.style.marginLeft = window.innerWidth/30 + "px";
btn4.style.marginTop = window.innerWidth/50 + "px";
}
}
function link(type){
localStorage.setItem("type", type);
window.location.href = "game.html";
}