您可以使用$('#cube')。css({「transform」:「rotateY(」+ deg +「deg)」});在幾種情況下。我測試..
,並採取有助於http://css3.bradshawenterprises.com/transforms/
請看看這個。並得到一些幫助..
http://jsfiddle.net/j35Ad/
<div id="transDemo4" class="shadow hover">
<div id="rotateX">rotateX</div>
<div id="rotateY">rotateY</div>
<div id="rotateZ">rotateZ</div>
<p class="center">Hover me</p>
<div class="clear"></div>
</div>
#transDemo4 {
border: 1px solid #AAAAAA;
height: 190px;
margin: 0 auto 10px;
padding: 10px;
width: 400px;
}
.shadow {
box-shadow: 5px 5px 5px #AAAAAA;
}
#transDemo4 div:not(.clear) {
border: 1px solid blue;
float: left;
height: 130px;
margin: 10px 20px;
padding: 10px;
perspective: 800px;
perspective-origin: 50% 100px;
transition: all 2s ease-in-out 0s;
width: 70px;
}
.clear {
clear: both;
}
#transDemo4 div {
transition:all 2s ease-in-out;
perspective: 800px;
perspective-origin: 50% 100px;
}
#transDemo4:hover #rotateX {
transform:rotateX(180deg);
}
#transDemo4:hover #rotateY {
transform:rotateY(180deg);
}
#transDemo4:hover #rotateZ {
transform:rotateZ(180deg);
}