我有一個圖像被分成兩個相等的部分。我試圖在懸停時圍繞y軸旋轉-180°(逆時針)圖像的右側部分。圍繞y軸旋轉圖像
問題是有時(隨機)圖像旋轉180°(順時針)而不是-180°(逆時針)旋轉。這背後的原因是什麼?我正在使用chrome。
CSS: -
.container {
position: relative;
margin-top : 10px;
width : 500px;
height: 330px;
-webkit-perspective: 1500px;
box-shadow: 3px 3px 13px #AAA;
}
.frontDiv {
padding: 20px;
width: 500px;
height: 330px;
}
.frontImg {
position: absolute;
border:1px solid;
height : 281px;
width : 225px;
overflow: hidden;
background-image: url('iday.jpg');
transition:all 1s ease-in-out;
-webkit-transition:all 1s ease-in-out;
backface-visibility : hidden;
-webkit-transform-origin:0% 0%;
}
.f1 {
top: 20px;
left:20px;
background-position: 0px 0px;
}
.f2 {
top: 20px;
left:245px;
background-position: -225px 0px;
}
.frontDiv:hover .f2
{
-webkit-transform : rotateY(-180deg);
}
HTML: -
<article class='container'>
<div class='frontDiv'>
<div class='frontImg f1'></div>
<div class='frontImg f2'></div>
</div>
</article>
我已經無法看到的錯誤發生。無論如何,我已經添加了你的代碼小提琴;這樣就更容易測試。 – vals
我無法從小提琴中重現此錯誤。 – Bryce
@vals感謝小提琴瓦爾,因爲我在你的小提琴裏一直在順時針方向旋轉。即使在-180度角度下 –