IE11问题与变换rotateY和backface-visibilty悬停效果

时间:2016-04-20 15:04:48

标签: jquery html css3

我正在处理我正在处理的代码问题,在Chrome和FF中运行完全正常,但在IE中却没有。

基本上它是一种简单的悬停效果,游戏在Y轴上翻转180度,同时将鼠标悬停在Y轴上。背面可见性设置为隐藏但在IE中不是这种情况。任何想法为什么?正在考虑引入一些jquery可能解决甚至更旧的IE版本的问题..

HTML:

<div class="flip-container game">
                <div class="flipper">
                <a href="#">
                    <div class="front">
                      <h1>
            Front
            </h1>
                    </div>
                    <div class="back">
                            <span class="game-title">
                                <h3>BACK</h3>
                                <span class="mob-icon"></span>
                            </span>

                            <button class="button green"><a href="#">Play Now</a></button>
                            <button class="blue button"><a href="#">More Info</a></button>
                    </div>

                </a>
                </div>
            </div>

CSS:

   /*  do some flipping  */
.flip-container {
    perspective: 1000;
    transform-style: preserve-3d;
}
    /* flip the pane when hovered */
    .flip-container:hover .flipper, .flip-container.hover .flipper {
        transform: rotateY(180deg) scale(1.05);
        position: relative;
        z-index: 2;
    }


.flip-container, .front, .back {
    width: 185px;
    height: 145px;
}

.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

/* hide back of pane during swap */
.front, .back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

/* front pane, placed above back */
.front {
    z-index: 2;
    transform: rotateY(0deg);
    background-color: #333;
    color: #000;
    text-align: center;
}

/* back, initially hidden pane */
.back {
    transform: rotateY(180deg);
    background-color: #010b15;
    border: solid 2px #034baf;
}

FIDDLE - https://jsfiddle.net/Lcdrugvn/3/

2 个答案:

答案 0 :(得分:1)

找到解决方案 -

/* do some flipping */

.flip-container {
    perspective: 1000;
    transform-style: preserve-3d;
}

.flip-container:hover .back {
    transform: rotateY(0deg);
    }

.flip-container:hover .front {
      transform: rotateY(180deg);
    }

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

/* flip speed goes here */
.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

/* hide back of pane during swap */
.front, .back {
    backface-visibility: hidden;
    transition: 0.6s;
    transform-style: preserve-3d;
    position: absolute;
    top: 0;
    left: 0;
  width: 185px;
  height: 145px;
}

.front {
    z-index: 2;
    transform: rotateY(0deg);
  background-color: #333;
  color: #000;
  text-align: center;
}

.back {
    transform: rotateY(-180deg);
  background-color: #010b15;
  border: solid 2px #034baf;
}

答案 1 :(得分:0)

/*  do some flipping  */
.flip-container {
    perspective: 1000;
    transform-style: preserve-3d;
}
    /* flip the pane when hovered */
    .flip-container:hover .flipper, .flip-container.hover .flipper {
        transform: rotateY(180deg) scale(1.05);
        position: relative;
        z-index: 2;
    }

.flip-container:hover .back {
        transform: rotateY(0deg);
    }
    .flip-container:hover .front {
        transform: rotateY(180deg);
    }

.flip-container, .front, .back {
    width: 185px;
    height: 145px;
}

.flipper {
    transition: 0.4s;
    transform-style: preserve-3d;
    position: relative;
}

/* hide back of pane during swap */
.front, .back {
    backface-visibility: hidden;
    transition: 0.4s;
    transform-style: preserve-3d;

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

/* front pane, placed above back */
.front {
    z-index: 2;
    transform: rotateY(0deg);
    background-color: #333;
    color: #000;
    text-align: center;
}

/* back, initially hidden pane */
.back {
    transform: rotateY(180deg);
    background-color: #010b15;
    border: solid 2px #034baf;
}

试试这个,请调整转换时间