I want to create a bootstrap flip card by using CSS3 transform. I did started from this working and basic example
However I wanted to modify it to have a fixed height card and some minor enhancement. In particular I needed to have the card flip when the user click on an icon I have created on the top right corner.
I have modified the code as you can see here.
The problem is that the card does not flip back to front after having flipped correctly to the back side.
Can anybody suggest any solution?
NOTE: the problem seems to be with the jquery code. Actually I have
$('div.flipControl').on('click', function () {
$(this).closest('div[class="card"]').toggleClass('flipped');
});
But if I change it with
$('div.flipControl').on('click', function () {
$(this).parent().parent().parent().toggleClass('flipped');
});
Everything works as expected.
I think that it is much simpler using directly the CSS class selector
$('.flipControl').on('click', function(){
$(this).closest('.card').toggleClass('flipped');
});
来源:https://stackoverflow.com/questions/30698272/bootstrap-flip-card-with-css3-transform