Hi, I have a problem with a Velo code that was written to me by others. This code allows me to have a mega menu and also other codes have been created for me in case I want to associate this mechanism with other buttons. I tried to connect them to other buttons, but for some reason these 2 codes don’t want to work together. Let me explain: if I connect only the mega menu, the other button obviously does not work, but if in addition to the mega menu I also connect the other button, this works and the mega menu stops working. Separately they work, together they don’t. Is there something wrong with the code?
If we would also see some code, perhaps you also would get the one or another answer
You're right, here's the code:
$w.onReady(function () {
$w('#newYorkCollapseButton').onClick(() => {
toggleBox($w('#newYorkCollapsibleBox'), $w('#newYorkPlusSign'), $w('#newYorkMinusSign'));
});
$w('#tokyoCollapseButton').onClick(() => {
toggleBox($w('#tokyoCollapsibleBox'), $w('#tokyoPlusSign'), $w('#tokyoMinusSign'));
});
$w('#parisCollapseButton').onClick(() => {
toggleBox($w('#parisCollapsibleBox'), $w('#parisPlusSign'), $w('#parisMinusSign'));
});
});
function toggleBox(boxElement, plusSign, minusSign) {
const isCollapsed = boxElement.collapsed;
if (isCollapsed) {
plusSign.hide();
minusSign.show();
boxElement.expand();
} else {
minusSign.hide();
plusSign.show();
boxElement.collapse();
}
}
The mega menu is connected to NewYork while my new button is connected to Tokyo
Thank you very much
Tried to reconstruct your Mini-Menu but did not see any issues.
https://mt2-king.wixsite.com/filter-tool/mini-menu
Do i miss something?
Did you gave me all informations i should know?
Do you perhaps have also a screenshot?
Sorry but i am not a …
I managed to solve, in practice I deleted the first part of new york that did not refer to the mega menu, it was just a duplicate that sent all the tilt, the mega menu appears on all pages even without any code being written, so it must have been saved in some memory that I don't see. Thanks anyway for the support, you helped me understand that the code was correct and that the problem was another. Thanks again and happy easter