-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript.js
More file actions
44 lines (36 loc) · 1.74 KB
/
Copy pathScript.js
File metadata and controls
44 lines (36 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Placeholder for our upcoming JavaScript logic
document.addEventListener('DOMContentLoaded', function () {
// --- Quiz Logic ---
const options = document.querySelectorAll('.quiz-option');
const submitBtn = document.getElementById('submit-btn');
const scoreEl = document.getElementById('score');
let selectedOption = null;
window.selectOption = (el) => {
options.forEach(opt => opt.classList.remove('selected'));
el.classList.add('selected');
selectedOption = el;
}
submitBtn.addEventListener('click', () => {
if (!selectedOption) {
scoreEl.textContent = 'Please select an answer!';
scoreEl.style.color = '#F87171'; // Red
return;
}
if (selectedOption.textContent === 'Leonardo da Vinci') {
scoreEl.textContent = 'Correct! Well done!';
scoreEl.style.color = '#4ADE80'; // Green
} else {
scoreEl.textContent = 'Not quite. The correct answer is Leonardo da Vinci.';
scoreEl.style.color = '#FBBF24'; // Amber
}
});
// --- Contact Form ---
const form = document.getElementById('contact-form');
form.addEventListener('submit', (e) => {
e.preventDefault();
alert('Thank you for your message! (This is a demo)');
form.reset();
});
// We will add GSAP animations here in the next step!
console.log("Page structure loaded. Ready for animations.");
});