forked from BlackTimber-Labs/DemoPullRequest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCounter App
More file actions
86 lines (76 loc) · 1.65 KB
/
Counter App
File metadata and controls
86 lines (76 loc) · 1.65 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>counter</title>
</head>
<style>
body{
background-color: snow;
}
p{
top: 60px;
color: whitesmoke;
position: relative;
font-size: 4rem;
}
#container{
width: 200px;
height: 200px;
background-color: rgb(78, 78, 190);
border-radius: 20%;
position: relative;
left: 38%;
margin-top: 15%;
}
button{
box-shadow: 2px 2px 50px 2px rgb(13, 13, 19);
width: 50px;
border: 10px solid rgb(135, 235, 160);
border-radius: 45px;
padding: 0 10px 0 10px;
margin: 8px;
font-size: large;
background-color: snow;
border: snow;
height: 22px;
}
.inc{
top: 20px;
left: 30px;
position: relative;
}
.dec{
top: 20px;
left: 30px;
position: relative;
}
.inc:active,.dec:active{
font-size: 15px;
}
</style>
<body>
<div class="" id="container">
<p id="counter"style="text-align: center; margin-top: 50px;">0</p>
<button class="inc" id="inc">+</button>
<button class="dec" id="dec">-</button>
<script src="counter.js"></script>
</div>
<script >
const counter=document.getElementById("counter");
const inc=document.querySelector(".inc");
const dec=document.querySelector(".dec");
let count=0;
inc.addEventListener('click',function(){
count++;
counter.innerHTML=count;
});
dec.addEventListener('click',function(){
count--;
counter.innerHTML=count;
});
</script>
</body>
</html>