CSS3实现炫酷进度条
来源:互联网 发布:自由之战末那之冠淘宝 编辑:程序博客网 时间:2024/05/29 02:19
看了一个进度条很漂亮,所以自己试试看
html
<div class="load-container"><span class="run"></span><div class="meter">0</div></div>
* {margin: 0;padding: 0;font-family: 'microsoft yahei';}html,body {width: 100%;height: 100%;background-color: #222;}.load-container {width: 600px;height: 6px;margin: 0 auto;margin-top: 200px;background-image: -webkit-linear-gradient(left,#5bd8ff, #ff0000);border-radius: 5px;position: relative;}.run {position: absolute; width: 0px; height: 6px; right: 0px; background: #000; border-radius: 5px; animation: runnAnimation 10s linear;}@keyframes runnAnimation {0% {width: 600px;}100% {width: 0px;}}.run:after {content: "";display: block;width: 16px;height: 16px;border-radius: 50%;background-color: #f00;margin-left: -4px;margin-top: -4px;animation: destination 10s linear;}@keyframes destination {0% {background-color: #5bd8ff;}100% {background-color: red;}}.meter {float: right;margin-top: 10px; font-size: 40px; color: red; animation: fontColor 10s linear;}@keyframes fontColor {0% {color: #5bd8ff;}100% {color: red;}}.meter:after {content: "%"}
js代码如下:
window.onload = function() {var meter = document.querySelector('.meter');run(meter,100);function run(el,time) {time = time ? time : 100;el = el ? el : document;var i = 0;var timer = setInterval(function() {if(i<100) {i++;el.innerHTML = i;} else {clearInterval(timer);}},time)}}
效果图:
如果想要调整进度时间,需要修改css样式中animation的时间和js中的时间
PS:css未做前缀处理,所有测试都在最新谷歌浏览器下进行
0 0
- CSS3实现炫酷进度条
- CSS3实现GIF进度条
- CSS3实现动态进度条
- css3 实现进度条
- 用CSS3实现动画进度条
- css3实现闪亮进度条效果
- css3实现圆环加载进度条
- CSS3 实现 网页顶部进度条
- 利用css3实现漂亮进度条效果
- 纯CSS3实现的彩色进度条
- 纯css3实现的圆形进度条
- js+css3实现一个环形进度条插件
- css3实现圆环加载进度条动画
- CSS3和jQuery实现网页顶部进度条
- css3进度条
- css3 进度条
- CSS3实例教程:超炫的网页进度条
- CSS3实现酷炫导航
- 修改tomcat服务器默认的端口号
- style_include_selector
- STM32F0xx_PWR低功耗配置详细过程
- JStorm-2.1.1源码分析--Topology提交(下)
- Java设计模式之适配器模式
- CSS3实现炫酷进度条
- iOS视频录制、压缩导出、取帧
- JqueryEasyUi追加自定义工具标签
- 正则表达式小总结
- 关于图的常用算法——Dijkstra单源最短路径、Floyd多源最短路径、Prim和Kruskal最小生成树算法
- Broadcast广播机制
- SpringMVC之http的状态码(五)
- meter度量值,也可用作进度条
- [企业管理]员工生育保障问题的讨论