0
我有一個類似的問題,作爲CSS Transition not firing when adding class to body (Firefox)但我似乎找到一種方法來解決它以不同的方式針對元素或刪除類。css轉換不能在Firefox上工作
以下是我有:
標記:
<div class="ball b40 first">
<a class="ffx-fx" href="javascript:void(0)">
</a>
</div>
CSS:
.ffx-fx {
-webkit-transition: all 1.5s ease-in-out;
-moz-transition: all 1.5s ease-in-out;
-o-transition: all 1.5s ease-in-out;
-ms-transition: all 1.5s ease-in-out;
transition: all 1.5s ease-in-out;
}
.b40 a {
width:220px;
height:220px;
background: url(../images/temp/1_a.jpg) center center;
background-size: 100% 100% !important;
}
.b40 .b40-rotated {
width:220px;
height:220px;
background: url(../images/temp/1_b.jpg) center center !important;
}
個JS:
window.setInterval(function() {
$(".b40 .ffx-fx").toggleClass("b40-rotated");
}, 5000);
所以應該發生什麼,轉換似乎被設置在一個不同的元素上,而不是你要改變類的元素。它在其他瀏覽器中工作嗎? – adeneo 2014-12-02 23:47:04
您不能在背景圖像之間切換。但是,您可以堆疊背景圖像並更改不透明度。 [這是可以動畫的屬性的便利列表。](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties) – misterManSam 2014-12-03 00:22:15