Skip to content

Commit 214171c

Browse files
committed
vanila js progress bar
1 parent 14ef7d9 commit 214171c

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

loading-Bar/app.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const loadingBarEl = document.querySelector(".loading_inner");
2+
3+
let myWidth = 0;
4+
const loadingBar = setInterval(() => {
5+
myWidth++;
6+
if(myWidth === 100) {
7+
clearInterval(loadingBar)
8+
}
9+
loadingBarEl.style.width = `${myWidth}%`
10+
11+
}, 100);
12+
13+

loading-Bar/index.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Loading Bar</title>
8+
<link rel="stylesheet" href="styles.css">
9+
</head>
10+
<body>
11+
<div class="container">
12+
<h1>Loading Bar</h1>
13+
<div class="loading_outer">
14+
<div class="loading_inner"></div>
15+
</div>
16+
17+
</div>
18+
19+
<script src="app.js"></script>
20+
</body>
21+
</html>

loading-Bar/styles.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
h1 {
2+
text-align: center;
3+
}
4+
.loading_outer {
5+
width: 600px;
6+
height: 50px;
7+
border: 1px solid black;
8+
margin: auto;
9+
}
10+
.loading_inner{
11+
width: 800px;
12+
height: 50px;
13+
background-color: coral;
14+
}

0 commit comments

Comments
 (0)