Bootcamps

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Academy

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Full-Stack Software Developer - 16w

Data Science and Machine Learning - 16 wks

Search from all Lessons


LoginGet Started

Register to 4Geeks

← Back to Projects

Pop Balloons using HTML/CSS and a little Javascript

Difficulty

  • easy

Average duration

8 hrs

Technologies

Difficulty

  • easy

Average duration

8 hrs

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast

Pop Balloons game using Javascript, HTML/CSS 🎈🎊

This is an amazing game to practice HTML, CSS and a little Javascript. The game goal is to POP all the balloons by clicking on them.

🌱 How to start this project

This project comes with the necessary files to start working, but you have two options to start:

a) Open this link in your browser with gitpod (recommended): https://gitpod.io#https://github.com/breatheco-de/exercise-pop-baloons-javascript.git

b) You can clone this repository on your local computer:

1$ git clone https://github.com/breatheco-de/exercise-pop-baloons-javascript.git

Run the website by typing the following command on your terminal: $ npx http-server --yes -c-1

πŸ“ Instructions

Balloon Pop Game with HTML/CSS and Javascript

Build a game with the following workflow:

  1. When the website loads (window.onload) you have to render all the balloons.
  2. Every balloon needs to have an onClick attached to listen to when the user clicks on it.
  3. When the user clicks on it the balloon disappears (pops) from the screen.
  4. When all the 20 balloons have disappeared the website reloads and the game starts again.

πŸ’ͺ Strategy

Strategy to complete the pop balloons

  1. First, declare an array of 20 colors, each color will represent a balloon, the colors can repeat.
  2. To pop a balloon, you will have to turn the value on that balloon position on the array equal to null.
  3. Loop all the colors and make the html string for each balloon, you should generate a big html string like this, and add it into the DOM:
<div class="balloon active"></div>
<div class="balloon popped"></div>
<div class="balloon active"></div>
<div class="balloon active"></div>
  1. Add that string to the innerHTML of the <div id="balloon-map"> element using document.querySelector.

  2. Update your function that renders the ballons to add also an onClick on each balloon div to listen to the click.

  3. When a balloon is clicked, go the array of colors and turn the color back to null.

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • easy

Average duration

8 hrs

Difficulty

  • easy

Average duration

8 hrs

Difficulty

  • easy

Average duration

8 hrs

Difficulty

  • easy

Average duration

8 hrs

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • easy

Average duration

8 hrs

Difficulty

  • easy

Average duration

8 hrs

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast