File tree Expand file tree Collapse file tree 3 files changed +103
-0
lines changed
Expand file tree Collapse file tree 3 files changed +103
-0
lines changed Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ }
5+
6+ body {
7+ margin : 10px ;
8+ /* padding: 10px; */
9+ box-shadow : -30px 20px -1px black;
10+ }
11+
12+ # parent_div {
13+ height : 350px ;
14+ display : flex;
15+ align-items : center;
16+ justify-content : space-between;
17+ background-color : gray;
18+ border-radius : 50% ;
19+ }
20+
21+ .child_div {
22+ display : flex;
23+ justify-content : center;
24+ align-items : center;
25+ height : 300px ;
26+ width : 300px ;
27+ border-radius : 50% ;
28+ box-shadow : 8px 8px 12px # 112 ;
29+ animation : animate linear infinite 8s ;
30+ }
31+
32+ .child_div p {
33+ margin : 0 ;
34+ font : 50px bold;
35+ }
36+
37+ @keyframes animate {
38+ 0% {
39+ background-color : red;
40+ }
41+
42+ 25% {
43+ background-color : yellow;
44+ }
45+
46+ 50% {
47+ background-color : blue;
48+ }
49+
50+ 50% {
51+ background-color : orange;
52+ }
53+
54+ 75% {
55+ background-color : yellowgreen;
56+ }
57+
58+ 100% {
59+ background-color : red;
60+ }
61+ };
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+ < title > Counter</ title >
8+ < link rel ="stylesheet " href ="index_counter.css ">
9+ </ head >
10+
11+ < body >
12+ < div id ="parent_div ">
13+ < div class ="child_div ">
14+ < p class ="counterdata " data-counterdata ="1000 "> 0000</ p >
15+ </ div >
16+ < div class ="child_div ">
17+ < p class ="counterdata " data-counterdata ="1200 "> 0000</ p >
18+ </ div >
19+ < div class ="child_div ">
20+ < p class ="counterdata " data-counterdata ="1400 "> 0000</ p >
21+ </ div >
22+ < div class ="child_div ">
23+ < p class ="counterdata " data-counterdata ="1600 "> 0000</ p >
24+ </ div >
25+ </ div >
26+
27+ < script src ="index_counter.js "> </ script >
28+ </ body >
29+
30+ </ html >
Original file line number Diff line number Diff line change 1+ let counter = document . querySelectorAll ( '.counterdata' ) ;
2+
3+ for ( let single of counter ) {
4+ let count = 0 ;
5+ let counterUp = ( ) => {
6+ count ++ ;
7+ if ( count <= single . dataset . counterdata ) {
8+ single . innerHTML = count ;
9+ }
10+ }
11+ setInterval ( counterUp , 10 ) ;
12+ }
You can’t perform that action at this time.
0 commit comments