Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cat Game/DevanshKyada27 #997

Merged
merged 2 commits into from
May 17, 2024
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
92 changes: 75 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fortune Teller App</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Fortune Teller App</h1>
<p class="fortune"></p>
<button id="generate-fortune">Generate my Fortune</button>
</div>
<script src="script.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Cat Game</title>
</head>
<body>
<div class="container">
<div class="wrapper">
<div class="ears">
<div class="ear"></div>
<div class="ear"></div>
</div>
<div class="head">
<div class="mustaches">
<div class="mus">
<div class="mustach"></div>
<div class="mustach"></div>
<div class="mustach"></div>
</div>
<div class="mus">
<div class="mustach"></div>
<div class="mustach"></div>
<div class="mustach"></div>
</div>
</div>
<div class="eyes">
<div class="eye"></div>
<div class="eye"></div>
</div>
<div class="nose">
<div class="shape"></div>
</div>
<div class="mouth">^</div>
</div>
<div class="body"></div>
<div class="pads">
<div class="pad"></div>
<div class="pad"></div>
</div>
<div class="hat">
<div class="bottom"></div>
</div>
<div class="glasses">
<div class="glass"></div>
<div class="glass"></div>
</div>
<div class="tie"></div>
</div>
<div class="controls">
<input type="checkbox" id="eyeglasses">
<input type="checkbox" id="hat">
<input type="checkbox" id="tie">
<label class="glassescontrol" data-text="eyeglasses" for="eyeglasses">
<div class="glassesicon">
<div class="glassicon"></div>
<div class="glassicon"></div>
</div>
</label>
<label data-text="Hat" class="hatcontrol" for="hat">
<div class="haticon">
<div class="bottom">
</div>
</div>
</label>
<label data-text="Tie" class="tiecontrol" for="tie">
<div class="tieicon"></div>
</label>
</div>
</div>
<script src="./script.js"></script>
</body>
</html>
50 changes: 35 additions & 15 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
const fortunes = [
"Your future is looking bright!",
"A new opportunity will come your way soon.",
"You will find happiness in unexpected places.",
"Don't be afraid to take risks.",
"Good things will happen when you least expect them.",
"Believe in yourself, and you will succeed."

];

document.getElementById("generate-fortune").addEventListener("click", () => {
const randomIndex = Math.floor(Math.random() * fortunes.length);
const fortuneText = fortunes[randomIndex];
document.querySelector(".fortune").textContent = fortuneText;
});
//controls
const hatcheck = document.querySelector("#hat");
const glassescheck = document.querySelector("#eyeglasses");
const tiecheck = document.querySelector("#tie");
//accessories
const hat = document.querySelector(".hat");
const glasses = document.querySelector(".glasses");
const tie = document.querySelector(".tie");
//Reveal Hat
hatcheck.addEventListener("change", hatfun);
function hatfun() {
if (hatcheck.checked == true) {
hat.style.bottom = "165px";
} else {
hat.style.bottom = "400px";
}
}
//Reveal Eyeglasses
glassescheck.addEventListener("change", glassesfun);
function glassesfun() {
if (glassescheck.checked == true) {
glasses.style.right = "50%";
} else {
glasses.style.right = "-50%";
}
}
//Reveal Tie
tiecheck.addEventListener("change", tiefun);
function tiefun() {
if (tiecheck.checked == true) {
tie.style.bottom = "10px";
} else {
tie.style.bottom = "-80px";
}
}
Loading
Loading