jquery – 要在旋转时显示元素的厚度

我沿着Y轴旋转一枚硬币,通过CSS旋转90度.有没有办法让我可以在硬币旋转之后显示出硬币的厚度,我想我可以在Y轴上旋转硬币后才能放大,但是这似乎不起作用.请建议一些方法来做同样的事情,如果可能的话. link_on_js fiddle为相同.请使用webkit浏览器打开链接.

CSS

.coin {
    display: block;
    background: url("url-to-image-of-coin.jpg");
    background-size: 100% 100%;
    width: 100px;
    height: 100px;
    margin: auto;
    border-radius: 100%;
    transition: all 500ms linear;
}

.flip {
    transform: rotateY(180deg);
}

HTML

<div class="coin"></div>

jQuery的

$('.coin').click(function() {
    $(this).toggleClass('flip');
});

小提琴

http://jsfiddle.net/7EtLu/22/

解决方法

您可以使用伪元素来产生类似的效果.这是一个例子: http://jsfiddle.net/joshnh/y7rQL/
<div class="coin"></div>
body {
    transform: perspective(500px);
    transform-style: preserve-3d;
}
.coin {
    background-image: url("http://www.coolemails4u.com/wp-content/uploads/2010/10/indian_rupee.png");
    background-size: 100% 100%;
    border-radius: 100%;
    height: 100px;
    margin: 50px auto;
    position: relative;
    transition: .5s linear;
    transform-style: preserve-3d;
    width: 100px;
}
.coin:after {
    background-color: #262626;
    background-image: -webkit-linear-gradient(hsla(0,0%,100%,.25),hsla(0,.25));
    bottom: 0;
    content: '';
    left: 45px;
    position: absolute;
    top: 0;
    transform: rotateY(-90deg);
    transform-origin: 100% 50%;
    width: 5px;
    z-index: -10;
}
.coin:before {
    background-color: #262626;
    background-image: -webkit-linear-gradient(hsla(0,.25));
    border-radius: 100%;
    content: '';
    height: 100px;
    left: 0;
    position: absolute;
    top: 0;
    transform: translateZ(-5px);
    width: 100px;
}
.coin:hover {
    transform: rotateY(90deg);
}​

另外,这里是一个180度旋转的版本(虽然不太好):http://jsfiddle.net/joshnh/Bz22S/

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...