-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
195 additions
and
73 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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
*{ | ||
/* margin: 0; */ | ||
padding: 0; | ||
box-sizing: border-box; | ||
font-family: 'Poppins', sans-serif; | ||
} | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
margin: 0; | ||
} | ||
|
||
.details { | ||
position: relative; | ||
top: 0px; | ||
background-color: brown; | ||
display: flex; | ||
padding: 1px; | ||
color: wheat; | ||
} | ||
|
||
.details p { | ||
padding: 10px; | ||
font-size: 20px; | ||
text-align: center; | ||
} | ||
|
||
#target { | ||
width: 100px; | ||
height: 100px; | ||
background-color: deeppink; | ||
border-radius: 50%; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
font-size: 18px; | ||
padding: 5px; | ||
color: white; | ||
position: absolute; | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Alphabet Sequence</title> | ||
<link rel="stylesheet" href="../nav.css"> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<nav> | ||
<div class="header"> | ||
<a href="../index.html" class="logo">CSS</a><br> | ||
<p>Computer Steering Skills</p> | ||
<div class="header-right"> | ||
<a href="#about" onclick="refreshPage()">Refresh</a> | ||
<a href="#about">Log in</a> | ||
<a href="#about">Sign in</a> | ||
</div> | ||
</div> | ||
<script type="application/javascript" src="../nav.js"></script> | ||
</nav> | ||
|
||
<div class="body"> | ||
<div class="container"> | ||
<h1>Alphabet Sequence</h1> | ||
<p>Press the letters on your keyboard in alphabetical order!</p> | ||
<div class="alpha-grid" id="alpha-grid"></div> | ||
</div> | ||
</div> | ||
|
||
<audio id="alertSound" src="wrong.mp3"></audio> | ||
|
||
<script> | ||
const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i)); | ||
let expectedLetter = 'A'; | ||
|
||
const letterGrid = document.getElementById('alpha-grid'); | ||
const letterElements = []; | ||
const alertSound = document.getElementById('alertSound'); | ||
|
||
function createGrid() { | ||
const shuffledLetters = [...letters].sort(() => Math.random() - 0.5); | ||
shuffledLetters.forEach(letter => { | ||
const letterElement = document.createElement('div'); | ||
letterElement.classList.add('number'); | ||
letterElement.textContent = letter; | ||
letterElements.push(letterElement); | ||
letterGrid.appendChild(letterElement); | ||
}); | ||
} | ||
|
||
function handleKeyboardEvent(event) { | ||
const keyPressed = event.key.toUpperCase(); | ||
|
||
if (keyPressed === expectedLetter) { | ||
const currentLetterElement = letterElements.find(element => element.textContent === keyPressed); | ||
|
||
currentLetterElement.style.backgroundColor = '#27ae60'; | ||
currentLetterElement.style.pointerEvents = 'none'; | ||
|
||
expectedLetter = String.fromCharCode(expectedLetter.charCodeAt(0) + 1); | ||
checkWin(); | ||
} else { | ||
playAlertSound(); | ||
alert('Incorrect letter. Try again!'); | ||
} | ||
} | ||
|
||
function playAlertSound() { | ||
alertSound.currentTime = 0; | ||
alertSound.play(); | ||
} | ||
|
||
function checkWin() { | ||
if (expectedLetter > 'Z') { | ||
alert('Congratulations! You pressed all the letters in order!'); | ||
} | ||
} | ||
|
||
createGrid(); | ||
document.addEventListener('keydown', handleKeyboardEvent); | ||
</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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.body { | ||
font-family: 'Fira Sans', sans-serif; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 80vh; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
|
||
} | ||
|
||
.alpha-grid { | ||
display: grid; | ||
grid-template-columns: repeat(6, 100px); | ||
grid-gap: 2vh; | ||
margin-top: 20px; | ||
} | ||
|
||
.number { | ||
width: 60px; | ||
height: 60px; | ||
background-color: black; | ||
border-radius: 10%; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
color: yellow; | ||
font-size: 30px; | ||
font-weight: bold; | ||
} |
Binary file not shown.