Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BalloonPoppingGame/Somil-Shukla/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# javascript-balloon-popping-project
29 changes: 29 additions & 0 deletions BalloonPoppingGame/Somil-Shukla/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let popped = 0;

document.addEventListener('mouseover', function(e){

if (e.target.className === "balloon"){

e.target.style.backgroundColor = "#ededed";
e.target.textContent = "POP!";
popped++;
removeEvent(e);
checkAllPopped();
}
});

function removeEvent(e){
e.target.removeEventListener('mouseover', function(){

})
};

function checkAllPopped(){
if (popped === 24){
console.log('all popped!');
let gallery = document.querySelector('#balloon-gallery');
let message = document.querySelector('#yay-no-balloons');
gallery.innerHTML = '';
message.style.display = 'block';
}
};
44 changes: 44 additions & 0 deletions BalloonPoppingGame/Somil-Shukla/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Pop the Ballons</title>
</head>
<body>
<div class="wrapper">
<h1>Pop the balloons by moving</br>your mouse over them</h1>
<div id="yay-no-balloons"><span class="blue">Wow!</span> All balloons popped!</div>
<div id="balloon-gallery">
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
<div class="balloon"></div>
</div>

</div>
<script src="app.js"></script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions BalloonPoppingGame/Somil-Shukla/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
body{
font-family:sans-serif;
padding: 30px;
background:#ededed;
}

.wrapper{
max-width: 690px;
margin: 0 auto;
}

.blue {
color:#3f7abe;
}

h1{
margin: auto;
margin-top: 50px;
margin-bottom: 50px;
color: #08a3d9;
text-transform: uppercase;
font-size: 30px;
color: #000380;
}

#balloon-gallery div{
background: #ff3300;
height: 121px;
width: 119px;
text-align: center;
color: #ff3300;
font-size: 40px;
font-family: sans-serif, arial;
border-radius: 100%;
margin-top: 20px;
display: inline-block;
/* float: left; */
margin: 2.5px 5 px 2.5px 0px;
}

#balloon-gallery div:nth-child(3n){
background: #ffce00;
color: #ffce00;
}

#balloon-gallery div:nth-child(3n-1){
background:#3f7abe;
color:#3f7abe;
}

#balloon-gallery div:nth-child(5n){
background:#8e7a8e;
color:#8e7a8e;
}

#balloon-gallery div:nth-child(13){
background:#8e7a8e;
color:#8e7a8e;
}

#balloon-gallery div:nth-child(10n){
background:#ff3300;
color: #ff3300;
}

#balloon-gallery div:nth-child(4n){
clear:right;
}

#yay-no-balloons {
display:none;
color:#ff3300;
font-size:100px;
}