-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (23 loc) · 1.06 KB
/
Copy pathscript.js
File metadata and controls
29 lines (23 loc) · 1.06 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
document.addEventListener("DOMContentLoaded", () => {
const companyName = document.getElementById("company-name");
const ageVerification = document.getElementById("age-verification");
const yesBtn = document.getElementById("yes-btn");
const noBtn = document.getElementById("no-btn");
// Show the age verification on click
companyName.addEventListener("click", (e) => {
e.preventDefault();
ageVerification.classList.remove("hidden");
});
// Add the 'active' class to keep the company name yellow
companyName.classList.add("active");
// Handle "Yes" button click
yesBtn.addEventListener("click", () => {
localStorage.setItem("ageVerified", "true");
ageVerification.innerHTML = `<p>You're granted access!</p>`;
window.location.href = "https://squarespace.com"; // Redirect to About page
});
// Handle "No" button click
noBtn.addEventListener("click", () => {
ageVerification.innerHTML = `<p>This website is only available if you are over 21 years old.</p>`;
});
});