-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
121 lines (98 loc) · 3.13 KB
/
index.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chemigacha</title>
<style>
.turn {
position: relative;
display: inline-block;
margin-top: 40%;
margin-left: 39.30%;
height: 120px;
width: 150px;
}
.galary {
position: relative;
display: inline-block;
font-weight: bold;
padding: 0.5em 1em;
text-decoration: none;
border-left: solid 4px greenyellow;
border-right: solid 4px greenyellow;
color: black;
background: lightgreen;
transition: .4s;
}
.galary:hover {
background: greenyellow;
color: #FFF;
}
.galary:active {
-webkit-transform: translateY(4px);
transform: translateY(4px);
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2);
border-bottom: none;
}
body {
background-image: url(photo/home.png);
background-size: contain;
background-repeat: no-repeat;
background-color: lightyellow;
}
</style>
</head>
<body>
<!--ボタン-->
<div onclick="gatya()" class="turn" type="button">
<img src="photo/turn.png" class=turn alt="turn">
</div>
<div>
<button id="book" class="galary">ギャラリー</button>
</div>
<script>
//乱数
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
let group = ['H2', 'O2', 'Cl2', 'F2', 'W', 'He'];
let a = getRandomInt(group.length);
//ガチャを回す
function gatya() {
if (a == 0) {
localStorage.setItem('result', 'h');
localStorage.setItem('h', 'true');
}
else if (a == 1) {
localStorage.setItem('result', 'o');
localStorage.setItem('o', 'true');
}
else if (a == 2) {
localStorage.setItem('result', 'cl');
localStorage.setItem('cl', 'true');
}
else if (a == 3) {
localStorage.setItem('result', 'f');
localStorage.setItem('f', 'true');
}
else if (a == 4) {
localStorage.setItem('result', 'w');
localStorage.setItem('w', 'true');
}
else if (a == 5) {
localStorage.setItem('result', 'he');
localStorage.setItem('he', 'true');
}
//結果表示
window.location.href = 'https://hu-hicoder.github.io/ChemiGatya/gacharesult';
}
//ギャラリーへのボタン
document.getElementById("book")
.addEventListener("click", function () {
location.replace("https://hu-hicoder.github.io/ChemiGatya/galary");
}, false);
</script>
</body>
</html>