百度云盘  传送门  密码: 1pou

纯CSS上传进度条效果:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gary_ </title>
</head> <link rel="stylesheet" type="text/css" href="css/css.css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <body> <button type="button" onClick="processerbar(3000)">上传</button> <!--进度条区域-->
<div style="margin:10px;padding:10px;width:500px;height:500px;background:#EEE;"> <!-- 进度条 -->
<div class="barline" id="probar">
<div id="percent"></div>
<div id="line" w="100" style="width:0px;"></div>
<div id="msg" style=""></div>
</div> </div> <script language="javascript">
function processerbar(time){
document.getElementById('probar').style.display="block";
$("#line").each(function(i,item){
var a=parseInt($(item).attr("w"));
$(item).animate({
width: a+"%"
},time);
}); var si = window.setInterval(
function(){
a=$("#line").width();
b=(a/200*100).toFixed(0);
document.getElementById('percent').innerHTML=b+"%";
document.getElementById('percent').style.left=a-12+"px";
document.getElementById('msg').innerHTML="上传中";
if(document.getElementById('percent').innerHTML=="100%") {
clearInterval(si);
document.getElementById('msg').innerHTML="&nbsp;&nbsp;成功";
}
},900);
};
</script> </body>
</html>

index.html

@charset "utf-8";
body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,form,img,dl,dt,dd,table,th,td,blockquote,fieldset,strong,label,em{margin:0;padding:0;border:0;}
ul,ol,li{list-style:none;} .barline{
float:left;
width:200px;
background:#FFF;
border:2px solid #4DBF7D;
height:12px; display:inline-block;
border-radius:8px;
display:none;
position:absolute;left:100px;top:100px;
} .barline #percent{position:absolute;left:0px;top:-30px;display:inline-block;color:#4DBF7D;font-size:16px;}
.barline #line{float:left;height:12px;overflow:hidden;background:#4DBF7D;border-radius:8px;}
.barline #msg{position:absolute;left:80px;top:30px;display:inline-block;color:#4DBF7D;font-size:14px;}<!---->

css.css

实现过程:

一、进度条CSS属性

 1、位置

.barline{
float:left;
width:200px;
background:#FFF;
border:2px solid #4DBF7D;
height:12px; display:inline-block;
border-radius:8px;
display:none;
position:absolute;left:100px;top:100px;
}
display:block就是将元素显示为块级元素.
  block元素的特点是:
  总是在新行上开始;
  高度,行高以及顶和底边距都可控制;
  宽度缺省是它的容器的100%,除非设定一个宽度
  <div>, <p>, <h1>, <form>, <ul> 和 <li>是块元素的例子。
  display:inline就是将元素显示为行内元素.
  inline元素的特点是:
  和其他元素都在一行上;
  高,行高及顶和底边距不可改变;
  宽度就是它的文字或图片的宽度,不可改变。
  <span>, <a>, <label>, <input>, <img>, <strong> 和<em>是inline元素的例子。
  inline和block可以控制一个元素的行宽高等特性,需要切换的情况如下:
  让一个inline元素从新行开始;
  让块元素和其他元素保持在一行上;
  控制inline元素的宽度(对导航条特别有用);
  控制inline元素的高度;
  无须设定宽度即可为一个块元素设定与文字同宽的背景色。
  display:inline-block将对象呈递为内联对象,但是对象的内容作为块对象呈递。旁边的内联对象会被呈递在同一行内,允许空格。
  inline-block的元素特点:
  将对象呈递为内联对象,但是对象的内容作为块对象呈递。旁边的内联对象会被呈递在同一行内,允许空格。(准确地说,应用此特性的元素呈现为内联对象,周围元素保持在同一行,但可以设置宽度和高度地块元素的属性)

display属性inline、block、inline-block的区别

 2、进度条动画效果

<!--提示文字上传进度-->
.barline #percent{position:absolute;left:0px;top:-30px;display:inline-block;color:#4DBF7D;font-size:16px;}
<!--填充进度条上传百分比-->
.barline #line{float:left;height:12px;overflow:hidden;background:#4DBF7D;border-radius:8px;}
<!--提示文字上传状态-->
.barline #msg{position:absolute;left:80px;top:30px;display:inline-block;color:#4DBF7D;font-size:14px;}

二、响应事件

<button type="button" onClick="processerbar(3000)">上传</button>
<script language="javascript">
function processerbar(time){
<!--获取进度条ID-->
document.getElementById('probar').style.display="block";
<!--block此元素将显示为块级元素,此元素前后会带有换行符-->
<!--进度条填充触发的事件-->
$("#line").each(function(i,item){
<!--attr()方法设置进度条的填充多少-->
var a=parseInt($(item).attr("w"));
<!--animate()方法执行动画
$(item).animate({
width: a+"%"
},time);
}); <!-- clearInterval()方法创建执行定时操作时要使用全局变量:-->
var si = window.setInterval(
function(){
a=$("#line").width();
b=(a/200*100).toFixed(0);
<!--提示上传进度-->
document.getElementById('percent').innerHTML=b+"%";
<!--填充进度条上传百分比-->
document.getElementById('percent').style.left=a-12+"px";
<!--提示上传状态-->
document.getElementById('msg').innerHTML="上传中";
<!--当上传进度完成时调用下面方法-->
if(document.getElementById('percent').innerHTML=="100%") {
<!--通过 clearInterval() 方法来停止执行window.setInterval-->
clearInterval(si);
<!--提示上传成功-->
document.getElementById('msg').innerHTML="&nbsp;&nbsp;成功";
}
},70);
};
</script>

(每一步都有自己的说明,选择插入代码发现没有高亮显示Js注解的,∑(= = !)。。。)

JS框架_(JQuery.js)上传进度条的更多相关文章

  1. JS框架_(JQuery.js)纯css3进度条动画

    百度云盘 传送门 密码:wirc 进度条动画效果: <!DOCTYPE html> <html lang="zh"> <head> <me ...

  2. JS框架_(JQuery.js)绚丽的3D星空动画

    百度云盘: 传送门 密码:8ft8 绚丽的3D星空动画效果(纯CSS) (3D星空动画可以用作网页背景,Gary为文本文字) <!doctype html> <html lang=& ...

  3. JS框架_(JQuery.js)Tooltip弹出式按钮插件

    百度云盘 传送门 密码:7eh5 弹出式按钮效果 <!DOCTYPE html> <html > <head> <meta charset="UTF ...

  4. JS框架_(JQuery.js)圆形多选菜单选项

    百度云盘 传送门 密码:zb1c 圆形多选菜单选项效果: <!DOCTYPE html> <html lang="en" > <head> &l ...

  5. jQuery实现上传进度条效果

    效果:(点击上传按钮) See the Pen pjGNJr by moyu (@MoYu1991) on CodePen. html代码:   <!DOCTYPE html> <h ...

  6. JS框架_(JQuery.js)动画效果鼠标跟随

    百度云盘 传送门 密码 :4n9u 火狐浏览器上纯CSS_动画效果鼠标跟随效果: (作者:lily_lcj 传送门) <!DOCTYPE html PUBLIC "-//W3C//DT ...

  7. JS框架_(JQuery.js)图片相册掀开切换效果

    百度云盘 传送门 密码:y0dk 图片掀开切换效果: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&quo ...

  8. JS框架_(JQuery.js)夜晚天空满天星星闪烁动画

    百度云盘 传送门 密码:xftr 满天星星闪烁动画效果: (可用星空动画来作为页面背景,白色文字改为文章或者其他的O(∩_∩)O) <!doctype html> <html> ...

  9. JS框架_(JQuery.js)模拟刮奖

    百度云盘:传送门 密码:6p5q 纯CSS模拟刮奖效果 <!DOCTYPE html> <html lang="en"> <head> < ...

随机推荐

  1. PB动态游标代码段

    sql = "select p_partno  from p_partno_rm group by p_partno order by p_partno"declare my3 d ...

  2. maven中scope属性的

    Dependency Scope 在POM 4中,<dependency>中还引入了<scope>,它主要管理依赖的部署.目前<scope>可以使用5个值: * c ...

  3. solr学习笔记-增加mmesg4J中文分词

    solr版本6.1.centos6.7.mmesg4j版本2.30 solr安装目录:/usr/local/solr-6.1.0 1.下载mmesg4j包: 地址:https://github.com ...

  4. [Nest] 02.nest之控制器

    控制器 Controller Nest 的核心概念 模块 Module 控制器 Controller 服务与依赖注入 Provider Dependency injection 控制器负责处理应用的特 ...

  5. 惟一ID生成方法

    几乎所有的业务系统,都存在生成惟一ID的需求,例如: 用户ID:user_id 订单ID: order_id 消息ID: msg_id 常见的ID生成有三大类方法: 一.中间件实现 1.利用Mysql ...

  6. C语言typedef详解

    原文链接 C语言允许用户使用 typedef 关键字来定义自己习惯的数据类型名称,来替代系统默认的基本类型名称.数组类型名称.指针类型名称与用户自定义的结构型名称.共用型名称.枚举型名称等.一旦用户在 ...

  7. mac系统下Eclipse + pydev配置python Interpreter

    mac系统下Eclipse + pydev配置python Interpreter   之前都在windows下使用Eclipse + pydev 进行开发,未发现什么异常,最近对wxpy.itcha ...

  8. 网络初级篇之配置telnet登录网络设备(实验)

    一.作用     在日常工作中,登录网络设备,对其进行配置主要有几种方式:console.Telnet与ssh.这样可以实现远程(只要网络可达)控制,极大的方便了工作.今天主要讲解一下配置Telnet ...

  9. ValueError:Object arrarys cannot be loaded when allow_pickle=False

    运行python程序报错:ValueError:Object arrarys cannot be loaded when allow_pickle=False 错误原因:numpy版本太高 解决方案: ...

  10. Elasticsearch改动

    随着Elasticsearch的版本升级,Elasticsearch的一些特性也在改变,下面是一些需要注意的地方 v6.x 版本之前 : 一个index下面是可以创建多个type v6.x 版本 : ...