-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
44 lines (41 loc) · 1.35 KB
/
index.html
File metadata and controls
44 lines (41 loc) · 1.35 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MEMORY GAME</title>
<link rel="stylesheet" href="style.css">
<script src="main.js"></script>
</head>
<body>
<h1>Memory Game</h1>
<button class="collapsible">Instruction</button>
<div class="content">
<ul>
<li>You will start by flipping over one card.</li>
<li>If the next card you flip matches, a pop up alert notifies you and you get +1 to your score.</li>
<li>These cards then disappear.</li>
<li>If the next card you flip does not match, a pop up alert notifies you of ths and the cards flip back.</li>
<li>The game continues until you match all the cards on the board.</li>
</ul>
</div>
<h2>Score: <span id="result"></span></h2>
<div class="grid"></div>
<button id="dis" onclick="location.reload()">Play Again</button>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>
</body>
</html>