如何让 div 在页面加载时隐藏,然后在页面加载后向下滑动?我不想使用 CSSdisplay:none;
尝试一下这个小提琴:http://jsfiddle.net/ahr3U/
这基本上使用 CSS3 设置过渡的所有参数(过渡属性使动画成为可能),然后在文档加载后添加可见类以触发动画。
这是代码:
HTML:
<div id="notification">Page load complete...</div>
CSS:
#notification {
background-color: #F00;
color: #FFF;
height: 25px;
position: absolute;
top: -25px;
width: 100%;
transition: top 0.5s;
-moz-transition: top 0.5s;
-webkit-transition: top 0.5s;
-o-transition: top 0.5s;
}
#notification.visible {
top: 0px;
}
JavaScript:
$(document).ready(function(){
$("#notification").addClass("visible");
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)