繁体   English   中英

CSS 3D转换只有一半可点击

[英]CSS 3D Transform Only Half Clickable

我正在尝试创建一种可翻转的卡片,该卡片在点击时会翻转。 该卡默认是面朝下的,由于某种原因,只能单击卡的右半部分。 我正在尝试使整个卡片都可以单击和翻转。 下面以JSFiddle为例。

http://jsfiddle.net/aa3Lc/

.card {
    background: #fff;
    cursor: pointer;
    display: inline-block;
    font-size: 1.5em;
    font-weight: 800;
    line-height: 2em;
    border: 2px solid #000;
    height: 50px;
    margin: 5px 0 ;
    text-align: center;
    width: 38px;

    border-radius: 3px;
    -webkit-transform: perspective(1000px) rotateY(180deg);
    -moz-transform: perspective(1000px) rotateY(180deg);
    transform: perspective(1000px) rotateY(180deg);
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    transition: all 0.2s linear;
}
.card.active {
    -webkit-transform: perspective(1000px) rotateY(0deg);
    -moz-transform: perspective(1000px) rotateY(0deg);
    transform: perspective(1000px) rotateY(0deg);
}
.card .card-front {
    display: block;
    width: 38px;
    height: 100%;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
}
.card .card-back {
    cursor: pointer;
    display: block;
    width: 38px;
    height: 100%;
    box-sizing: border-box;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
}

更改-webkit-transform: perspective(1000px) rotateY(180deg); .card

-webkit-transform: perspective(1000px) rotateY(180deg) translateZ(-1px);

解决您的问题。 演示

不能100%确定为什么还要为每个perspective(1000px)都设置perspective(1000px) perspective: 1000px; .card上的转换下方,并删除所有其余的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM