Calculator Tools Calculator Tools
Create

Pop It Eletrônico Quadrado Colorido

Jan 4, 2024

About this app

A fun and colorful electronic version of the popular fidget toy, Pop It!

Pop It Eletrônico Quadrado Colorido

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Pop It Eletrônico Quadrado Colorido</title>
<meta name="description" content="A fun and colorful electronic version of the popular fidget toy, Pop It!">
<meta name="keywords" content="pop it, fidget toy, electronic, colorful, fun">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
document.addEventListener("DOMContentLoaded", function() {
const popItContainer = document.getElementById('pop-it-container');
const popItButton = document.getElementById('pop-it-button');

// Function to generate a random color
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}

// Function to handle the pop it button click event
function handlePopItButtonClick() {
const newColor = getRandomColor();
popItContainer.style.backgroundColor = newColor;
}

// Add event listener to the pop it button
popItButton.addEventListener('click', handlePopItButtonClick);
});
} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
body {
font-family: 'Roboto', sans-serif;
background-color: #f7f7f7;
}

#main-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.pop-it-container {
width: 200px;
height: 200px;
background-color: #e74c3c;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: background-color 0.3s ease;
}

.pop-it-button {
font-size: 24px;
color: #ffffff;
transition: transform 0.3s ease;
}

.pop-it-container:hover {
background-color: #c0392b;
}

.pop-it-button:active {
transform: scale(0.95);
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div id="pop-it-container" class="pop-it-container">
<i id="pop-it-button" class="fa fa-smile-o pop-it-button"></i>
</div>
</div>
</body>
</html>