forked from rprotsyk-zz/algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
progress-bar.html
38 lines (35 loc) · 1 KB
/
progress-bar.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
38
<html>
<style>
.bar {
width: 100%;
height: 100px;
background-color: grey;
border: black 2px solid;
}
.progress {
width: 10%;
height: 100px;
background-color: green;
}
</style>
<script>
var progressVal=0;
function buttonClick() {
let progress = document.getElementsByClassName('progress')[0];
var progressInterval = setInterval(function() {
progressVal += 10;
progress.style.width = progressVal + '%';
progress.style.transition = 'width 0.5s ease';
if(progressVal >= 100) {
clearInterval(progressInterval)
}
}, 500);
}
</script>
<body>
<div class="bar">
<div class="progress"></div>
</div>
<button onclick="buttonClick()">Start progress</button>
</body>
</html>