3

I am developing a functionality where I am flipping a div with background image. When I flip the div there should be a new image on other side.

I have tried following jquery plugin and the results are:

  1. Flippy: It is working very fine in IE10, chrome and firefox but it is not working in IE9 correctly It makes image to disappear and flips gray colored div.

  2. Flip!: It makes image to disappear and flips gray colored div.

  3. image flip: 2D flip

  4. Quick flip: 2D flip

  5. rotate3di: 3d flip but it appears like we are viewing from certain angle.

Please suggest a way for flipping a div in IE9. Any help will be appreciated

aug
  • 11,138
  • 9
  • 72
  • 93
AkshayP
  • 188
  • 3
  • 11

5 Answers5

3

CSS transitions is the reason why your code is not working in IE9. CSS transition is used to animate object by changing CSS (no JavaScript required). jQuery.flippy.js uses this to animate object. Sadly CSS transitions came after IE9 and so there is no support for CSS transition in it.

I have been through similar problem in past (http://bitotsav.in/#!/shows) and I choose to give somewhat trivial animation for IE9 and below.

However if you want to have flip animation on IE9 then visit Flip card effect for non-webkit browsers

The link above may contain some solution to your problem.

Community
  • 1
  • 1
Pushkar
  • 339
  • 3
  • 16
0

For FF and Chrome, I fiddled here:
http://jsfiddle.net/RXU84/

However, I could not test it on IE, as I don't have access to right now.
Thanks to this guy here.. David

HTML

<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
    <div class="flipper">
        <div class="front">
            <!-- front content -->
            <img src="http://i.imgur.com/FrJqOAP.jpg"/>
        </div>
        <div class="back">
            <!-- back content -->
            <img src="http://i.imgur.com/eIkgvPL.jpg"/>
        </div>
    </div>
</div>

CSS

        /* simple */
    .flip-container {
        -webkit-perspective: 1000;
        -moz-perspective: 1000;
        perspective: 1000;

        border: 1px solid #ccc;
    }


        .flip-container:hover .flipper, 
                    .flip-container.hover .flipper, #flip-toggle.flip .flipper {
            -webkit-transform: rotateY(180deg);
            -moz-transform: rotateY(180deg);
            transform: rotateY(180deg);
            filter: FlipH;
            -ms-filter: "FlipH";
        }

    .flip-container, .front, .back {
        width: 320px;
        height: 427px;
    }

    .flipper {
        -webkit-transition: 0.6s;
        -webkit-transform-style: preserve-3d;

        -moz-transition: 0.6s;
        -moz-transform-style: preserve-3d;

        transition: 0.6s;
        transform-style: preserve-3d;

        position: relative;
    }

    .front, .back {
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        backface-visibility: hidden;

        position: absolute;
        top: 0;
        left: 0;
    }

    .front {
        background: lightgreen;
        z-index: 2;
    }

    .back {
        background: lightblue;
        -webkit-transform: rotateY(180deg);
        -moz-transform: rotateY(180deg);
        transform: rotateY(180deg);
    }

    .front .name {
        font-size: 2em;
        display: inline-block;
        background: rgba(33, 33, 33, 0.9);
        color: #f8f8f8;
        font-family: Courier;
        padding: 5px 10px;
        border-radius: 5px;
        bottom: 60px;
        left: 25%;
        position: absolute;
        text-shadow: 0.1em 0.1em 0.05em #333;

        -webkit-transform: rotate(-20deg);
        -moz-transform: rotate(-20deg);
        transform: rotate(-20deg);
    }
TheAshwaniK
  • 1,706
  • 1
  • 14
  • 15
0

i think this is what you need see this demo : FLIPPING CIRCLE SLIDESHOW

it's flipping with more than image,easy code to follow and you can customize it so you have what you need.

hope this will help.

AhmedBinNasser
  • 2,735
  • 1
  • 24
  • 24
0

try this...

  #skew {

transform:skew(35deg); }

#scale {

transform:scale(1,0.5); }

#rotate {

transform:rotate(45deg); }

#translate {

transform:translate(10px, 20px); }

#rotate-skew-scale-translate {

transform:skew(30deg) scale(1.1,1.1) rotate(40deg) translate(10px, 20px); }

0

Edit: This DOES work in IE9, IE just simply hates jsfiddle and refuses to make it work. In other words, death to IE!

I would recommend using canvas! If you canvas is 100x100 and you load a picture on the canvas that is 100x200 half will be outside. When you flip the image the other part will show (though it'll be flipped, so the original image would have to be flipped).

http://jsfiddle.net/H82Tq/1/

var c = document.getElementById("joker");
var ctx = c.getContext("2d");
var img = document.createElement('img');
img.src = 'http://i.istockimg.com/file_thumbview_approve/7625283/2/stock-illustration-7625283-joker-face-two-playing-card.jpg';


var b = false;
$(c).click(function(){
    if (b) {
        ctx.drawImage(img, -246, 0, 246, 380);
    } else {
        ctx.drawImage(img, 0, 0, 246, 380);
    }

    b = !b;
    ctx.scale(-1, 1);
}).click();
Camathon
  • 514
  • 2
  • 5
  • 22