CSS动画淡出似乎不起作用
CSS animations fadeIn doesn't seem to work
我想在我的网页上应用一个淡出效果在我的网页内容上,但不是让淡出效果我的内容只是"隐藏"。
这是我使用的CSS:/* make keyframes that tell the start state and the end state of our object */
@-webkit-keyframes fadeIn { from { opacity:0 !important; } to { opacity:1 !important; } }
@-moz-keyframes fadeIn { from { opacity:0 !important; } to { opacity:1 !important; } }
@keyframes fadeIn { from { opacity:0 !important; } to { opacity:1 !important; } }
fadeIn
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation:fadeIn ease-in 1 ; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation:fadeIn ease-in 1 ;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s ;
-moz-animation-duration:1s ;
animation-duration:1s ;
}
.fade-in.one {
-webkit-animation-delay: 0.7s ;
-moz-animation-delay: 0.7s ;
animation-delay: 0.7s;
}
对于这段html:
<div data-role="content" id="contenidoHistoria" class="fade-in one">
<p>Entre los melismas sonoros del rebalaje y las intrincadas calles del antiguo barrio del Perchel, y a la sombra espiritual de su Iglesia parroquial del Carmen, surgió en el año 2005 el sueño colectivo de un grupo de jóvenes de aquel barrio, que bajo el ánimo y el empuje del entonces párroco nuestro querido Manolo Segura- se propusieron poner en marcha la hoy conocida como Banda de Cornetas y Tambores de Nuestra Señora del Carmen del Perchel-Málaga.</p>
</div><!-- /content -->
</div>
如果我设置不透明度为非0。淡入{透明度:0;/*使事物在开始时不可见*/"我可以看到内容,但这当然不是我想要的。
问候。
从动画属性中移除!important
。(同时删除关键帧声明下面的"fadeIn")
这是一个工作版本:
http://jsfiddle.net/x62pU/2/我还编辑了动画声明的简写,以减少您的代码。
我让它在firefox, chrome和safari中工作。这是JSFiddle的链接。
@-webkit-keyframes fadeIn { 0% { opacity:0; } 100% { opacity:1; } }
@keyframes fadeIn { 0% { opacity:0; } 100% { opacity:1; } }
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation: fadeIn 1s ease-in;
animation: fadeIn 1s ease-in;
-webkit-animation-fill-mode: forwards;
animation-fill-mode:forwards;
}
.fade-in.one {
-webkit-animation-delay: 0.7s;
animation-delay: 0.7s;
}
希望这对你有帮助!
相关文章:
- 添加/删除类淡入淡出不起作用
- 淡入淡出脚本不起作用
- 纯 JavaScript 淡入淡出 - 淡入不起作用
- 淡入淡出链接悬停不起作用
- 淡出加载然后淡入不起作用
- jQuery图像淡入淡出不起作用
- jQuery父对象(“tr”)淡出不起作用
- 淡入淡出和AppendTo不起作用-jQuery
- jquery 和 safari 7 - slide切换和淡入淡出切换不起作用
- function(){如果淡出,则追加}不起作用
- 淡入淡出 JavaScript 中的图像不起作用
- 为什么这种淡出不起作用
- JQuery 幻灯片向上和淡出“不起作用”
- 淡入和淡出功能不起作用
- 淡入/淡出功能不起作用
- 淡出功能在所有浏览器中都不起作用
- 为什么这种淡入淡出效果不起作用
- jquery淡出并重定向在IE中不起作用
- 淡入淡出css动画不起作用
- Ajax.BeginForm淡出不起作用