Hello! I came across a really cool card flip code that is IE compatible. I made some modifications to it and got it working, but there's one problem - instead of flipping the selected card, it flips all the cards. I tried modifying the JavaScript code but couldn't get it to work:
Here is the HTML:
<div class="c-services__item">
<div class="c-services__item__content">
<div class="c-services__item--front">Front</div>
<div class="c-services__item--back">Back</div>
</div>
</div>
<div class="c-services__item">
<div class="c-services__item__content">
<div class="c-services__item--front">Front</div>
<div class="c-services__item--back">Back</div>
</div>
</div>
JavaScript:
$('.c-services__item').hover(function(){$('.c-services__item').toggleClass('applyflip');}.bind(this));
I attempted to modify it like this:
$(".c-services__item").hover(function(){
$(this).find(".c-services__item").toggleClass("applyflip");}.bind(this));
});
});
but that didn't fix the issue.
CSS :
.c-services__item {
perspective: 1000px;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
-ms-perspective: 1000px;
width: 200px;
height: 337px;
}
.c-services__item .c-services__item__content {
transition: 0.5s ease-out;
-webkit-transition: 0.5s ease-out;
-moz-transition: 0.5s ease-out;
-o-transition: 0.5s ease-out;
-ms-transition: 0.5s ease-out;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
// content backface is visible so that static content still appears
backface-visibility: visible;
-webkit-backface-visibility: visible;
-moz-backface-visibility: visible;
-o-backface-visibility: visible;
-ms-backface-visibility: visible;
position:relative;
width: 100%;
height: 337px;
}
.c-services__item.applyflip .c-services__item__content {
transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
}
.c-services__item .c-services__item__content .c-services__item--static {
// Half way through the card flip, rotate static content to 0 degrees
transition: 0s linear 0.17s;
-webkit-transition: 0s linear 0.17s;
-moz-transition: 0s linear 0.17s;
-o-transition: 0s linear 0.17s;
-ms-transition: 0s linear 0.17s;
transform: rotateY(0deg);
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
text-align: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 337px;
line-height:100px;
}
.c-services__item.applyflip .c-services__item__content .c-services__item--static {
// Half way through the card flip, rotate static content to -180 degrees -- to negate the flip and unmirror the static content
transition: 0s linear 0.17s;
-webkit-transition: 0s linear 0.17s;
-moz-transition: 0s linear 0.17s;
-o-transition: 0s linear 0.17s;
-ms-transition: 0s linear 0.17s;
transform: rotateY(-180deg);
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
}
...and so on...