本文摘自PHP中文网,作者巴扎黑,侵删。
这篇文章通过实例代码给大家介绍了HTML5等待加载动画效果的完美解决方案,感兴趣的朋友参考下吧废话不多说了,直接给大家贴代码了,具体代码如下所示:
1 2 3 | <p class = "loading" >
<p>100<span></span></p>
</p>
|
1 2 3 4 5 6 7 8 9 10 | *{margin:0;padding:0;}
.loading{
height:100%;width:100%;position:fixed;background:rgba(255,255,255,1);
}
.loading >p{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;height:160px;width:160px;text-align: center;line-height:160px;font-size: 30px;color:#f00;}
.loading p span{position:absolute;display:block;height:140px;width:140px;margin:10px;border-radius:50%;-webkit-box-shadow:0 2px 3px rgba(102,197,37,0.8); animation:loading ease 1s infinite;left:0;top:0;}
@keyframes loading{
0%{transform:rotate(0deg)}
100%{transform:rotate(360deg)}
}
|

1 2 3 4 5 6 7 8 9 | <p class = "loading" >
<p>
<i></i>
<i></i>
<i></i>
<i></i>
<i></i>
</p>
</p>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | *{margin:0;padding:0;}
.loading{
height:100%;width:100%;position:fixed;background:rgba(255,255,255,0.95);
}
.loading >p{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;height:30px;width:120px;}
.loading >p i{display: block;float:left;margin:0 5px; width:5px;height:30px;background:#f00;transform:scaleY(0.3);
animation:loading 1s ease infinite alternate;
}
.loading >p i:nth-child(2){animation-delay:0.1s;}
.loading >p i:nth-child(3){animation-delay:0.2s;}
.loading >p i:nth-child(4){animation-delay:0.3s;}
.loading >p i:nth-child(5){animation-delay:0.4s;}
@keyframes loading{
0,40%,100%{transform:scaleY(0.3);}
20%{transform:scaleY(1);}
}
|

其实我想做的是加载进度条效果,但是假的进度条太烂,真的又没有特别好的办法,判断图片这种总感觉比较漏。
这是代码,有完美解决方案了解决。
1 2 3 4 5 6 7 | <script>
document.onreadystatechange= function (){
if (document.readyState== 'complete' ){
$( '.loading' ).fadeOut();
}
}
</script>
|
以上就是HTML5加载时的等待动画效果制作的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
如何使用HTML5 canvas实现图像的马赛克
HTML5开发手机打电话发短信功能代码实例分享
HTML5是什么技术
分享h5中alt和title的区别与用法
详细介绍HTML5技术在风电、光伏等新能源领域的应用(图)
iconfont图标引用的方法步骤(代码)
h5调用相机拍照并压缩图片
HTML5实践-灰色图片画廊实现的方法
HTML5各种头部meta标签的功能
HTML5支持所有音频格式吗
更多相关阅读请进入《HTML5》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » HTML5加载时的等待动画效果制作