-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (28 loc) · 1010 Bytes
/
script.js
File metadata and controls
41 lines (28 loc) · 1010 Bytes
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
let fontSize = 16;
let ballonEl = document.getElementById("ballon");
let inflateButton = document.getElementById("inflate-button");
let deflateButton = document.getElementById("deflate-button");
let newBallon = document.getElementById("new-button");
function inflate() {
fontSize *= 1.1;
ballonEl.style.fontSize = fontSize + "px";
if (fontSize > 99) {
ballonEl.textContent = "💥";
inflateButton.removeEventListener("click", inflate);
deflateButton.removeEventListener("click", Deflate);
}
}
function Deflate() {
fontSize /= 1.1;
ballonEl.style.fontSize = fontSize + "px";
}
function Ballon() {
inflateButton.addEventListener("click", inflate);
deflateButton.addEventListener("click", Deflate);
ballonEl.textContent = "🎈";
fontSize = 16
ballonEl.style.fontSize = 16 + "px";
}
inflateButton.addEventListener("click", inflate);
deflateButton.addEventListener("click", Deflate);
newBallon.addEventListener("click", Ballon);