Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
</sub>
</a>
</td>
<td align="center">
<a href="https://github.com/niftyNitin">
<img src="https://avatars.githubusercontent.com/u/57863681?v=4" width="100px;" alt="Nitin Kumar Gupta"/>
<br />
<sub>
<b>Harsh Narayan</b>
</sub>
</a>
<br />
</td>
</tr>


Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function restartGame(){
{
flippedCards.forEach(flippedCard=>{
flippedCard.children[0].src="#"; // Removing image src so that it isn't visible through HTML
// Removing class so that it can be flipped again
flippedCard.classList.remove('flip');
flippedCard.children[0].alt="card front face"; // Removing image alt so that it isn't visible through HTML
flippedCard.children[1].style.display="block";
})
Expand All @@ -107,7 +109,9 @@ function restartGame(){
card.children[0].src=cardImageSrcs[i]; // Setting image source for flipped front face
card.children[0].alt=cardImageSrcs[i].split('/').slice(-1)[0].split('.').slice(0, -1).join('.'); // Setting image file name as alt text for flipped front face
card.children[1].style.display="none";

console.log(card);
// Adding flip class to card to flip it
card.classList.add('flip');
//when we have filled two cards check for the match
if(flippedCards.length === 2)
{
Expand Down
5 changes: 5 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ header{
background-color: white;
}

.memory-card.flip {
transform: rotateY( 180deg ) ;
transition: transform 0.5s;
}

.memory-card>img{
position: absolute;
top:50%;
Expand Down