博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
进度条效果
阅读量:7071 次
发布时间:2019-06-28

本文共 1149 字,大约阅读时间需要 3 分钟。

hot3.png

<!DOCTYPE html>
<html>
<head>
<meta charset=
"utf-8"
>
<title>进度条效果</title>
<script src=
"http://libs.baidu.com/jquery/1.9.0/jquery.js"
></script>
<style type=
"text/css"
>
#progress
{
 
background:white;
 
height:20px;
 
padding:2px;
 
border:1px solid green;
 
margin:2px;
}
#progress span
{
 
background:green;
 
height:16px;
 
text-align:center;
 
padding:1px;
 
margin:1px;
 
display:block;
 
color:yellow;
 
font-weight:bold;
 
font-size:14px;
 
width:0%;
}
</style>
<script type=
"text/javascript"
>
 
var
progress_node_id =
"progress"
;
 
function
SetProgress(progress) {
  
if
(progress) {
   
$(
"#"
+ progress_node_id +
" > span"
).css(
"width"
, String(progress) +
"%"
);
   
$(
"#"
+ progress_node_id +
" > span"
).html(String(progress) +
"%"
);
  
}
 
}
 
var
i = 0;
 
function
doProgress() {
 
if
(i > 100) {
  
alert(
"Progress Bar Finished!"
);
  
return
;
 
}
 
if
(i <= 100) {
  
setTimeout(
"doProgress()"
, 500);
  
SetProgress(i);
  
i++;
 
}
 
}
 
$(document).ready(
function
() {
  
doProgress();
 
});
</script>
</head>
<body>
<h1>jQuery实现进度条效果代码</h1>
<p>原理就是使用 Javascript 控制 SPAN CSS 的宽度(以及其他的样式),刷新查看</p>
<div id=
"progress"
><span></span></div>
</body>
</html>

转载于:https://my.oschina.net/yonghan/blog/482789

你可能感兴趣的文章
css--水平居中,垂直居中,自适应宽度
查看>>
Google Map API V3 离线版
查看>>
ZFS与数据去重
查看>>
《敏捷软件开发》学习笔记 第16章 单例模式和MonoState模式
查看>>
PHP拦截器的使用(转)
查看>>
获取GridView控件总列数
查看>>
Vim 中使用cscope
查看>>
HR系统+人脸识别
查看>>
RabbitMQ与AMQP协议详解
查看>>
metronic后台模板学习 -- 所用外部插件列表
查看>>
微软原版SQLHelper类
查看>>
首页设计的可用性和PET
查看>>
mongodb的分布式集群(1、主从复制)
查看>>
http://www.cnblogs.com/yaozhenfa/archive/2015/06/14/4574898.html
查看>>
使用自定义tld标签简化jsp的繁琐操作
查看>>
Div Vertical Menu ver3
查看>>
动态为DropDownList添加Item
查看>>
spring NotWritablePropertyException异常
查看>>
TCP是如何保证可靠传输的
查看>>
【Python】爬取理想论坛单帖爬虫
查看>>