.jiage{overflow:hidden;width:72%; background:url(../images/bg_2.png); margin:0 auto; position:absolute; left:14%;top:140px; z-index:1;animation:myfirst 1.5s linear 2s;-webkit-animation:myfirst 1.5s linear 2s;-o-animation:myfirst 1.5s linear 2s; -moz-animation:myfirst 1.5s linear 2s;-ms-animation:myfirst 1.5s linear 2s; }
@keyframes myfirst
{
0%{ top:-170px;}
100%{ top:140px; }
}
@-webkit-keyframes myfirst
{
0%{ top:-170px;}
100%{ top:140px;}
}
我想在页面加载后2s让这个动画播放,但是初始位置定在top:140px; 这样动画前两秒会出现在页面中,2s后执行从-170-140这个动作,怎么能让他前2s不出现,2s后执行动画
用js来控制,2s过后,给该元素添加动画这部分的css
用js来控制,2s过后,给该元素添加动画这部分的css
用js来控制,2s过后,给该元素添加动画这部分的css
用js来控制,2s过后,给该元素添加动画这部分的css
window.onload=function(){} //页面加载完成,自动执行该函数
用 jquery 做动画多好,css3的动画不是很灵活,兼容性也是不好
还是用jq做动画吧。。。
animation有动画延迟的属性
animation-delay:2s;
-webkit-animation-delay:2s;
.jiage{overflow:hidden;width:72%; background:url(../images/bg_2.png); margin:0 auto; position:absolute; left:14%;top:-170px; z-index:1;animation:myFirst 1.5s linear 2s forwards } @keyframes myFirst { 0%{ top:-170px;} 100%{ top:140px; } }
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号