-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcafe.js
More file actions
35 lines (31 loc) · 1.04 KB
/
Copy pathcafe.js
File metadata and controls
35 lines (31 loc) · 1.04 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
document.addEventListener("DOMContentLoaded", function () {
const specials = [
"Cappuccino",
"Chocolate Croissant",
"Eggs Benedict",
"Fruit Salad",
];
const specialElement = document.getElementById("special-of-the-day");
const randomSpecial = specials[Math.floor(Math.random() * specials.length)];
specialElement.innerText = `Today's Special: ${randomSpecial}`;
});
document.addEventListener("DOMContentLoaded", function () {
const menuSections = document.querySelectorAll(".menu-section");
// Initialize the sections as closed
menuSections.forEach((section) => {
const items = section.querySelectorAll("ul li");
items.forEach((item) => {
item.style.display = "none";
});
section.addEventListener("click", () => {
// Toggle the visibility of menu items
items.forEach((item) => {
if (item.style.display === "none") {
item.style.display = "block";
} else {
item.style.display = "none";
}
});
});
});
});