5

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.

Siguza
  • 21,155
  • 6
  • 52
  • 89
Lorenzo
  • 29,081
  • 49
  • 125
  • 222

1 Answers1

4

I think that it is much simpler using directly the CSS class selector

$('.flipControl').on('click', function(){
    $(this).closest('.card').toggleClass('flipped');

});

demo

vals
  • 61,425
  • 11
  • 89
  • 138
  • @RaviKChowdary but the problem is on the IE handling wrong the transforms, not with the jQuery to trigger it – vals Sep 29 '16 at 21:29
  • 1
    :- in this case, how to resolve to work with IE. As i know IE does not support transforms. Is this any other way can achieve it ? – RKCY Sep 29 '16 at 21:44