Content popup when unit button on sidebar clicked won't show up?
Unanswered
Spectacled bear posted this in #help-forum
Spectacled bearOP
When I try and pop up the content from the sidebar, nothign shows up when clicked, can someone help? I've attached all teh related files enough tho its not part of the whole direcoty. Also, here's the JS file related to all this:
export function initializeSidebar() {
if (typeof window === 'undefined') return () => {};
const links = Array.from(document.querySelectorAll(".sidebar ul a[data-unit]"));
const sections = Array.from(document.querySelectorAll("[id^='unit-']"));
const welcomeMessage = document.getElementById("welcome-message");
if (!links.length || !sections.length) return () => {};
sections.forEach(sec => sec.classList.add("hidden"));
if (welcomeMessage) welcomeMessage.style.display = "block";
const onClick = (e) => {
e.preventDefault();
const target = e.currentTarget;
const targetId = target.getAttribute("data-unit");
if (welcomeMessage) welcomeMessage.style.display = "none";
sections.forEach(sec => sec.classList.add("hidden"));
if (targetId) {
const targetSection = document.getElementById(targetId);
if (targetSection) targetSection.classList.remove("hidden");
}
};
links.forEach(link => link.addEventListener("click", onClick));
return () => {
links.forEach(link => link.removeEventListener("click", onClick));
};
}
export function initializeSidebar() {
if (typeof window === 'undefined') return () => {};
const links = Array.from(document.querySelectorAll(".sidebar ul a[data-unit]"));
const sections = Array.from(document.querySelectorAll("[id^='unit-']"));
const welcomeMessage = document.getElementById("welcome-message");
if (!links.length || !sections.length) return () => {};
sections.forEach(sec => sec.classList.add("hidden"));
if (welcomeMessage) welcomeMessage.style.display = "block";
const onClick = (e) => {
e.preventDefault();
const target = e.currentTarget;
const targetId = target.getAttribute("data-unit");
if (welcomeMessage) welcomeMessage.style.display = "none";
sections.forEach(sec => sec.classList.add("hidden"));
if (targetId) {
const targetSection = document.getElementById(targetId);
if (targetSection) targetSection.classList.remove("hidden");
}
};
links.forEach(link => link.addEventListener("click", onClick));
return () => {
links.forEach(link => link.removeEventListener("click", onClick));
};
}