-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #997 from DevanshKyada27/Cat-Game
Cat Game/DevanshKyada27
- Loading branch information
Showing
3 changed files
with
447 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
Oops, something went wrong.