forked from Chuyue0/javascript-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjq_progressbar.html
37 lines (33 loc) · 927 Bytes
/
jq_progressbar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>加载进度条</title>
<style type="text/css">
.container{width: 450px;height: 20px; border: 1px solid #c8c8c8; border-radius: 10px; overflow: hidden}
#loaded{height: 100%; background-color: orange; line-height: 150%;}
#prog{height: 100%;background-color: orangered;line-height: 150%; text-align: center;}
</style>
<script src="jquery-1.12.0.min.js"></script>
</head>
<body>
<div class="container">
<div id="prog" style="width:0%;"></div>
</div>
<script type="text/javascript">
function setProg(){
var prog=document.getElementById("prog");
prog.style.width=parseInt(prog.style.width)+1+"%";
prog.innerHTML=prog.style.width;
if(prog.style.width=="100%"){
window.clearInterval(timer);
return;
}
}
var timer=window.setInterval(function(){setProg();},50);
window.onload=function(){
timer;
}
</script>
</body>
</html>