JS实现进度条动态加载特效


Posted in Javascript onMarch 25, 2020

本文实例为大家分享了JS实现进度条动态加载的具体代码,供大家参考,具体内容如下

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>进度条</title>
 <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
 <style type="text/css">
 .container{
 width: 480px;
 margin: 50px;
 }
 .progressBar {
 display: inline-block;
 width: 81%;
 height: 22px;
 background-color: rgba(0,0,0,0.4);
 -webkit-border-radius: 3px;
 -moz-border-radius: 3px;
 border-radius: 3px;
 margin-right: 3%;
 }
 #progressFill {
 width: 0%;
 height: 22px;
 position: relative;
 background-color: #40A4C2;
 border-radius: 3px;
 -webkit-border-radius: 3px;
 -moz-border-radius: 3px;
 background-size: 3em 3em;
 background-image: linear-gradient(-45deg, transparent 0em, transparent 0.8em, #57D1F7 0.9em, #57D1F7 2.1em, transparent 2.1em, transparent 2.9em, #57D1F7 3.1em);
 -webkit-animation: warning-animation 750ms infinite linear;
 -moz-animation: warning-animation 750ms infinite linear;
 animation: warning-animation 750ms infinite linear;
 }
 #progressFill:before {
 content: '';
 position: absolute;
 top: 0;
 left: 0;
 right: 0;
 bottom: 0;
 height: 100%;
 border-radius: 3px;
 -webkit-border-radius: 3px;
 -moz-border-radius: 3px;
 background-image: linear-gradient(to bottom, #40A4C2, rgbA(37, 117, 188, 0.8) 15%, transparent 60%, #40A4C2);
 }
 @-moz-keyframes warning-animation {
 0% {
 background-position: 0 0;
 }
 100% {
 background-position: 3em 0;
 }
 }
 @-webkit-keyframes warning-animation {
 0% {
 background-position: 0 0;
 }
 100% {
 background-position: 3em 0;
 }
 }
 @-ms-keyframes warning-animation {
 0% {
 background-position: 0 0;
 }
 100% {
 background-position: 3em 0;
 }
 }
 @-o-keyframes warning-animation {
 0% {
 background-position: 0 0;
 }
 100% {
 background-position: 3em 0;
 }
 }
 @keyframes warning-animation {
 0% {
 background-position: 0 0;
 }
 100% {
 background-position: 3em 0;
 }
 }
 .progressText, #percentage {
 display: inline-block;
 margin-top: -11px;
 vertical-align: middle;
 }
 </style> 
</head>
<body>
 <button id = "begin">点击开始</button>
 <div class="container">
 <span class = "progressBar">
 <div id = "progressFill"></div>
 </span>
 <span class = "progressText"> 进度 </span>
 <span id = "percentage">0%</span>
 </div> 
</body>
<script>
 $("#begin").on("click",function(){
 $("#progressFill").animate({ 
 width: "100%"
 }, 10*1000);
 var count = 0;
 var timer = setInterval(function(){
 count++;
 var percentageValue = count + '%'
 $("#percentage").html(percentageValue);
 if(count >= 100) clearInterval(timer);
 },99)
 })
</script>
</html>

进度条动态加载效果图如下

JS实现进度条动态加载特效

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持三水点靠木。

Javascript 相关文章推荐
js的闭包的一个示例说明
Nov 18 Javascript
利用腾讯的ip地址库做ip物理地址定位
Jul 24 Javascript
上传文件返回的json数据会被提示下载问题解决方案
Dec 03 Javascript
jQuery插件Skippr实现焦点图幻灯片特效
Apr 12 Javascript
js中substr,substring,indexOf,lastIndexOf,split,replace的用法详解
Nov 09 Javascript
jQuery设置Cookie及删除Cookie实例分析
Apr 15 Javascript
JavaScript和jquery获取父级元素、子级元素、兄弟元素的方法
Jun 05 Javascript
jQuery simpleModal插件的使用介绍
Aug 30 Javascript
ES6 javascript中class类的get与set用法实例分析
Oct 30 Javascript
Vue单页及多页应用全局配置404页面实践记录
May 22 Javascript
vue-quill-editor+plupload富文本编辑器实例详解
Oct 19 Javascript
VueJs里利用CryptoJs实现加密及解密的方法示例
Apr 29 Javascript
使用Angular9和TypeScript开发RPG游戏的方法
Mar 25 #Javascript
javascript+css实现进度条效果
Mar 25 #Javascript
JS实现可控制的进度条
Mar 25 #Javascript
js实现简单进度条效果
Mar 25 #Javascript
JavaScript实现简单进度条效果
Mar 25 #Javascript
JavaScript实现随机点名程序
Mar 25 #Javascript
微信小程序分享小程序码的生成(带参数)以及参数的获取
Mar 25 #Javascript
You might like
Cappuccino 卡布其诺咖啡之制作
2021/03/03 冲泡冲煮
用PHP4访问Oracle815
2006/10/09 PHP
php实现12306火车票余票查询和价格查询(12306火车票查询)
2014/01/14 PHP
Session的工作机制详解和安全性问题(PHP实例讲解)
2014/04/10 PHP
php中simplexml_load_file函数用法实例
2014/11/12 PHP
PHP上传文件时自动分配路径的方法
2015/01/09 PHP
分享一则PHP定义函数代码
2015/02/26 PHP
typecho插件编写教程(二):写一个新插件
2015/05/28 PHP
PHP中模拟链表和链表的基本操作示例
2016/02/27 PHP
PHP模板引擎Smarty内建函数详解
2016/04/11 PHP
PHP中加速、缓存扩展的区别和作用详解(eAccelerator、memcached、xcache、APC )
2016/07/09 PHP
TFDN图片播放器 不错自动播放
2006/10/03 Javascript
jquery下为Event handler传递动态参数的代码
2011/01/06 Javascript
js解析xml字符串和xml文档实现原理及代码(针对ie与火狐)
2013/02/02 Javascript
基于JavaScript实现继承机制之构造函数方法对象冒充的使用详解
2013/05/07 Javascript
javascript怎么禁用浏览器后退按钮
2014/03/27 Javascript
页面元素绑定jquery toggle后元素隐藏的解决方法
2014/03/27 Javascript
AngularJs实现ng1.3+表单验证
2015/12/10 Javascript
js获取页面及个元素高度、宽度的代码
2016/04/26 Javascript
jQuery操作动态生成的内容的方法
2016/05/28 Javascript
jquery插件canvaspercent.js实现百分比圆饼效果
2017/07/18 jQuery
解决Vue使用swiper动态加载数据,动态轮播数据显示白屏的问题
2018/09/27 Javascript
微信小程序wepy框架学习和使用心得详解
2019/05/24 Javascript
vue props 单项数据流实例分享
2020/02/16 Javascript
Python的numpy库中将矩阵转换为列表等函数的方法
2018/04/04 Python
python将回车作为输入内容的实例
2018/06/23 Python
对Python random模块打乱数组顺序的实例讲解
2018/11/08 Python
Keras实现支持masking的Flatten层代码
2020/06/16 Python
银行存款证明样本
2014/01/17 职场文书
幸福家庭事迹材料
2014/02/03 职场文书
趣味体育活动方案
2014/02/08 职场文书
庆祝国庆节演讲稿2014
2014/09/19 职场文书
2015学习委员工作总结范文
2015/04/03 职场文书
2015年挂职锻炼个人总结
2015/10/22 职场文书
MySQL Router的安装部署
2021/04/24 MySQL
MySQL GRANT用户授权的实现
2021/06/18 MySQL