top of page
bottom of page
document.addEventListener("DOMContentLoaded", function () {
let searchBox = document.getElementById('searchBox');
searchBox.addEventListener('keyup', function () {
let input = searchBox.value.toLowerCase();
let sections = document.querySelectorAll('.guide-section');
sections.forEach(section => {
let text = section.innerText.toLowerCase();
if (text.includes(input)) {
section.style.display = "block"; // Show matching sections
} else {
section.style.display = "none"; // Hide non-matching sections
}
});
});
});
document.addEventListener("DOMContentLoaded", () => {
// Apri e chiudi il menu
const menuItems = document.querySelectorAll(".menu-item");
menuItems.forEach(item => {
item.querySelector(".menu-item-header").addEventListener("click", () => {
menuItems.forEach(i => {
if (i !== item) i.classList.remove("active");
});
item.classList.toggle("active");
});
});
// Funzione di ricerca nel menu
const searchBox = document.getElementById("searchBox");
if (searchBox) {
searchBox.addEventListener("keyup", function () {
let input = this.value.toLowerCase();
let menuItems = document.querySelectorAll(".menu-item");
menuItems.forEach(item => {
let title = item.querySelector(".menu-item-header span").innerText.toLowerCase();
let content = item.querySelector(".menu-item-content").innerText.toLowerCase();
if (title.includes(input) || content.includes(input)) {
item.style.display = "block";
} else {
item.style.display = "none";
}
});
});
}
});