Skip to content

Commit

Permalink
Added header and reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
quynhnle135 committed Feb 22, 2024
1 parent 6f070fe commit e5751a9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 8 deletions.
15 changes: 14 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
<!-- Link for Question Mark material-icons -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"/>
<link rel="stylesheet" href="style.css">
<!-- Google Font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<title>Memory Game</title>
</head>
<body>
<h1 id="game-header">Memory Game</h1>
<div class="wrapper">
<ul class="cards">
<li class="card">
Expand Down Expand Up @@ -140,8 +145,16 @@
</div>
</li>
</ul>
<button id="reset-button" onclick="shuffleCards()">Reset</button>
</div>


<!-- <div id="winModal" class="modal">
<div class="modal-container">
<span class="close">&times;</span>
<p>You Win!</p>
</div>
</div>
-->
<script src="script.js"></script>
</body>
</html>
10 changes: 5 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ function matchCards(img1, img2) {
if (img1 === img2) {
matched++;
// If all 8 pairs are matched, shuffle cards to reset
if (matched === 8) {
setTimeout(() => {
return shuffleCards();
}, 1000);
}
// if (matched === 8) {
// setTimeout(() => {
// return shuffleCards();
// }, 1000);
// }
cardOne.removeEventListener("click", flipCard);
cardTwo.removeEventListener("click", flipCard);
cardOne = "";
Expand Down
54 changes: 52 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ body {
background-color: #6563ff;
}

#game-header {
font-weight: 700;
font-size: 35px;
padding: 10px 10px 30px 10px;
text-align: center;
justify-content: center;
color: white;
z-index: 1;
top: 150px;
margin: auto;
position: fixed;
font-family: "Press Start 2P", system-ui;
}

#reset-button {
padding: 10px 20px;
border-radius: 5px;
color: white;
border: none;
background-color: #6563ff;
width: 100%;
margin: 30px 0px 0px 0px;
box-shadow: 5px 5px 2px hsl(241, 93%, 83%);
letter-spacing: 3px;
font-size: 15px;
font-family: "Press Start 2P", system-ui;
}

.wrapper {
padding: 25px;
border-radius: 10px;;
Expand Down Expand Up @@ -94,7 +122,29 @@ body {
}
}


.back-view img {
max-width: 45px;;
}
}

/* .modal {
position: fixed;
z-index: 1;
left: 35.5%;
top: 43%;
width: 500px;
height: 800px;
font-family: "Press Start 2P", system-ui;
}
.modal-container {
text-align: center;
justify-content: center;
padding: 25px;
border-radius: 10px;;
background: #FF9843;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.modal .close {
} */

0 comments on commit e5751a9

Please sign in to comment.