显示淡入效果的div的代码如下所示
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in {
opacity:0;
-webkit-animation:fadeIn ease-in 1;
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards;
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:2s;
-moz-animation-duration:2s;
animation-duration:2s;
}
.fade-in.one
{
-webkit-animation-delay: 1.7s;
-moz-animation-delay: 1.7s;
animation-delay: 1.7s;
}
然后我将它用于需要在加载时淡入的div。
<div class="fade-in one">
<label>Message Box</label>
This box will show some messages
</div>
此代码在chrome和firefox中运行良好,但是它显示没有动画。
请帮助解决此问题。我在代码和IE版本中尝试了很多更改。但没有快乐。请帮帮....