在移动屏幕中删除翻转图像

时间:2017-06-28 09:24:08

标签: html css3

我试图翻转图像。这很好。但是这个图像翻转也发生在手机屏幕上。我不想在移动屏幕上翻转这个。我试过一种方法。但那不是工作。

这是代码......!



.f1_container {
    position: relative;
    margin:10px;
    width: 450px;
    height: 281px;
    z-index : 1;
    float:left;
}
.f1_container {
    -webkit-perspective: 1000;
    perspective: 1000;
}
.f1_card {
    width: 100%;
    height: 100%;
    -webkit-transform-style: preserve-3d;
    -webkit-transition: all 1.0s linear;
    transform-style: preserve-3d;
    transition: all 1.0s linear;
}
.f1_container:hover .f1_card {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
    box-shadow: -5px 5px 5px #aaa;
}
.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.face.back {
    display: block;
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
    box-sizing: border-box;
    color: white;
    text-align: center;
    background-color: #aaa;
}
body{width:2000px}

@media (max-width: 482px) {
  .f1_container:hover .f1_card {
    -webkit-transform: rotateY(0deg);
    transform: rotateY(0deg);
    box-shadow: -5px 5px 5px #aaa;
}
  }

<div class="f1_container">
    <div class="shadow f1_card">
        <div class="front face">
            <img src="http://media-cdn.tripadvisor.com/media/photo-s/03/48/0b/14/dolphin-view-chalets.jpg" style="height: 281px; width: 450px;" />
        </div>
        <div class="back face center">Some text inside here</div>
    </div>
</div>

<div class="f1_container">
    <div class="shadow f1_card">
        <div class="front face">
            <img src="http://media-cdn.tripadvisor.com/media/photo-s/03/48/0b/14/dolphin-view-chalets.jpg" style="height: 281px; width: 450px;" />
        </div>
        <div class="back face center">Some text inside here</div>
    </div>
</div>

<div class="f1_container">
    <div class="shadow f1_card">
        <div class="front face">
            <img src="http://media-cdn.tripadvisor.com/media/photo-s/03/48/0b/14/dolphin-view-chalets.jpg" style="height: 281px; width: 450px;" />
        </div>
        <div class="back face center">Some text inside here</div>
    </div>
</div>

<div class="f1_container">
    <div class="shadow f1_card">
        <div class="front face">
            <img src="http://media-cdn.tripadvisor.com/media/photo-s/03/48/0b/14/dolphin-view-chalets.jpg" style="height: 281px; width: 450px;" />
        </div>
        <div class="back face center">Some text inside here</div>
    </div>
</div>
&#13;
&#13;
&#13;

如何在移动屏幕视图中隐藏此翻转。

2 个答案:

答案 0 :(得分:1)

将悬停事件添加到带有min-width的媒体查询,以仅允许其处理大于该视口的视口。

@media (min-width: 482px) {
    .f1_container:hover .f1_card {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
    box-shadow: -5px 5px 5px #aaa;
    }
}

答案 1 :(得分:1)

@media (max-width: 767px) {
.f1_container:hover .f1_card {
  transform: none;
}

用上面的

更改CSS属性