Skip to content
Advertisement

Memory game cards not flipping properly

The backside of my cards in my memory game are not flipping properly. At the moment when I hover over the front of any card, half of image on the back of the card appears first before the other half, as if the image was folded in half. Also the doesn’t look like it is flipping. What do I need to change in my code?

JavaScript
JavaScript

Advertisement

Answer

I think I annotated my changes, but in short:

  1. I disabled preserve-3d as it added a clipping effect which was undesireable (I think). Re-enable it to see the difference.
  2. I changed rotateX to rotateY in the .card-back selector, as it was rotating the wrong way. I also moved that higher up, but that was mostly for myself.
  3. I moved the transition-settings into a non-:hover-selector, so the transitions happen both “onHover” and “offHover“.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement