Skip to content

Commit db48757

Browse files
Add The Project
1 parent 4a0c96d commit db48757

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<html>
2+
<head>
3+
<title>Pop The Bubbles!</title>
4+
<meta charset="UTF-8"/>
5+
<script>
6+
var layer = 0;
7+
var count = 0;
8+
setInterval(function() {
9+
var newBubble = document.createElement("div");
10+
newBubble.style.position = "absolute";
11+
newBubble.style.marginLeft = (Math.floor(Math.random() * (window.innerWidth)) + 1) + "px";
12+
newBubble.style.marginTop = (Math.floor(Math.random() * (window.innerHeight)) + 1) + "px";
13+
newBubble.style.height = "24px";
14+
newBubble.style.width = "24px";
15+
newBubble.style.border = "1px solid DodgerBlue";
16+
newBubble.style.borderRadius = "24px";
17+
newBubble.style.backgroundColor = "DodgerBlue";
18+
layer += 1;
19+
newBubble.style.zIndex = layer;
20+
document.body.appendChild(newBubble);
21+
count += 1;
22+
document.getElementById("count").innerHTML = count;
23+
newBubble.onclick = function() {
24+
newBubble.innerHTML = "POP!";
25+
newBubble.style.border = "none";
26+
newBubble.style.backgroundColor = "";
27+
count -= 1;
28+
}
29+
}, 200);
30+
</script>
31+
</head>
32+
<body style="position: relative;">
33+
<div>Bubbles! There are currently <span id="count">0</span> bubbles on the screen. Click a bubble to pop it</div>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)