Question:
[Ensuring Only One Expandable Menu Item Is Opened at a Time]
Product:
[Wix studio]
What are you trying to achieve:
[ I’m using an expandable menu on WixStudio, and I want to ensure that only one menu item is open at a time. However, right now, multiple items can be opened simultaneously.]
Ekran Resmi 2025-02-24 15.24.52|214x500
Can someone help me?
Thanks!
Hello guys. Any solutions please?
i dont want to spam but still no answers
$w.onReady(function () {
let lastClickedItem = null;
// Menü öğelerinin her biri için onClick eventini tanımla
$w("#expandableMenu2").onItemClick((event) => {
const clickedItem = event.item; // Tıklanan menü öğesi
// Eğer önceki bir öğe tıklandıysa ve önceki öğe farklıysa
if (lastClickedItem && lastClickedItem !== clickedItem) {
// Önceki öğeyi de-seç (kapanma)
lastClickedItem.selected = false;
// Önceki öğe açılır menüsünü gizle
$w(`#${lastClickedItem.id}_submenu`).hide(); // Menü öğesinin alt menüsünü gizle
}
// Yeni tıklanan öğeyi seç
clickedItem.selected = true;
// Yeni tıklanan öğenin alt menüsünü göster
$w(`#${clickedItem.id}_submenu`).show(); // Menü öğesinin alt menüsünü göster
// Son tıklanan öğeyi kaydet
lastClickedItem = clickedItem;
// Konsola tıklanan öğenin label'ını yazdır
console.log("Clicked menu item:", clickedItem.label);
});
});
tried this one but did not work.
sorry for spamming but kinda important. UPUPUP
Hi, @cesurcan !!
So, what you’re looking for is a menu that behaves like this?
Introduction:
In this video, we’ll walk you through the step-by-step process of creating a dynamic accordion using the Maveristic Code Generator. See how we leverage the Repeater Accordion feature to seamlessly expand and collapse items based on the clicked index.
How I did it:
Design your section in the editor as desired.
Head over to https://www.maveristic.com/dynamic-code-generator
Choose “Repeater Accordion” and paste your three Handle IDs into the input fields.
Generate the code and cop…
yes! it is… cant we do it via wix menu?
Are you referring to an accordion menu when you say “expandable vertical menu” in the first place?