dvfrancis / hi-lo-card-game

Code Institute Milestone Project 2
1 stars 0 forks source link

Bug - cards display at incorrect size #61

Closed dvfrancis closed 2 hours ago

dvfrancis commented 2 hours ago

Renamed some classes and IDs to help in coding but now cards are not resizing correctly when flipped.

Image

dvfrancis commented 2 hours ago

This is the code I amended to auto-generate the id name based on array position:

cards[cardIndex].innerHTML = `

The first card
`;

However, looking at this in the browser it appears the name is not generating as I expected:

Image

The ID there should be card-1, card-2, etc.

dvfrancis commented 2 hours ago

I needed to simplify the code to just use the currentCard variable (which stores the index of the currently flipped card).

cards[cardIndex].innerHTML = `

The first card
`; // Flip the next card

Now the cards are targeted by the CSS correctly, and display at their correct size.