我有一个元素,当应用程序加载时没有背景图像。然后当点击一个按钮时,一个CSS类被添加到元素中,该元素为该元素设置背景图像几秒钟。问题是 - 我无法让背景图像淡入和淡出。如何使用CSS转换淡入和淡出背景图像?
我试了一下:
.MyBox.formElementInput {
background-repeat: no-repeat;
background-position: 65px center;
background-size: "contain";
-webkit-transition:background-image 2s ease-in-out;
-moz-transition: background-image 2s ease-in-out;
-o-transition: background-image 2s ease-in-out;
transition: background-image 2s ease-in-out;
}
.MyBox.formElementInput.showSpinner {
background-image : url("/PmDojo/dojox/widget/Standby/images/loading.gif");
}
编辑:jQuery是不是一种选择。
你是什么意思?眼下在 – antonpug
可能重复的是“滑”入位,而不是“淡入淡出”:http://stackoverflow.com/questions/5947582/fade-background-images-with-css3 –
@PatrickJamesMcDougle耶没有。 – antonpug