I’m having trouble with
Buttons appear under the sidebar
Working in
WixEditor - Velo - HTML
What I’m trying to do
Hello everyone, I created a sidebar (left) for my main menu (personalized code). I already have WIX buttons that control various actions, but the problem : they appear below the sidebar. Is it possible to make the buttons on my page appear in the foreground? That is, above my sidebar created in HTML.
I send you a capture below.
THANK YOU.
What I’ve tried so far
many codes but don’t work
I finally decided to create my HTML buttons in the sidebar wich use postmessage to call functions or actions.
The logs:
Clic détecté sur : btnAfficherReservations
Message posté vers Velo: afficherReservations
postmessage:
// Mapping id → action Velo
const buttonActionMap = {
btnAfficherReservations: “afficherReservations”,
btnEnregistrerReservation: “enregistrerReservation”,
btnCarte: “afficherCarte”,
btnTaxes: “taxes”,
btnFactures: “factures”,
btnAffichageEncaissements: “affichageEncaissements”,
btnJournalCaisse: “journalCaisse”,
btnClotureJournee: “clotureJournee”,
btnEnregistrerVente: “enregistrerVente”,
btnTarificationEpicerie: “tarificationEpicerie”,
btnSauvegarde: “sauvegardeDonnees”,
btnDonneesINSEE: “donneesINSEE”,
btnDiagnostics: “diagnostics”
};
const subMenuButtons = document.querySelectorAll(“.submenu-item”);
subMenuButtons.forEach(btn => {
btn.addEventListener(“click”, () => {
console.log(“Clic détecté sur :”, btn.id);
const label = btn.textContent.trim();
textMenu.textContent = label;
const action = buttonActionMap[btn.id];
if(action){
window.postMessage({ type: ‘sidebarClick’, action }, ‘*’);
console.log(📩 Message posté vers Velo: ${action});
} else {
console.warn(⚠️ Aucune action définie pour ${btn.id});
}
});
});
});
Here my velo code below: it doesnt work, even if Everything seems to be ok.
$w.onReady(function () {
window.addEventListener("message", (event) => {
const action = event.data?.action;
console.log("📥 Message reçu :", action);
switch(action) {
case "afficherReservations":
$w('#Accueil').collapse();
$w('#Listeresas').expand();
break;
case "enregistrerReservation":
$w('#Accueil').collapse();
$w('#RechercheClient').expand();
$w('#Rechercheclient').expand();
break;
case "afficherCarte":
wixWindow.openLightbox("Emplacements");
break;
case "taxes":
$w('#Accueil').collapse();
$w('#SectionTaxessejour').expand();
break;
case "factures":
wixWindow.openLightbox("Factures client");
break;
default:
console.warn("⚠️ Action inconnue reçue :", action);
}
});
}
})
But nothing happens…