Hello everyone, i need your help. I did a custom menu based on strips that hide and show when you hover over their respective button. I’m trying to minimize the amount of code using an IF statement or something else. I need the strip to hide when a button of itself is clicked.
The code right now looks like this:
//Used for hiding when you hover into page elements outside the menu
function hideAllStrips () {
$w('#SculptureStrip').hide();
$w('#HomeDecorStrip').hide();
$w('#GiftsStrip').hide();
$w('#OurWorldStrip').hide();
}
export function OurWorldStrip_mouseOut(event) {
$w('#OurWorldStrip').hide();
}
//Used to hide a strip when moving to another button that shows another strip
function hideAllButGiftStrip () {
$w('#SculptureStrip').hide();
$w('#HomeDecorStrip').hide();
$w('#GiftsStrip').show();
$w('#OurWorldStrip').hide();
}
export function GiftsButton_mouseIn(event) {
hideAllButGiftStrip()
// This is the part where I need your help, EACH button inside EACH strip adds this amount of code, 4 lines per button.
export function GiftsButton_click(event) {
wixLocation.to("/luxury-gifts");
$w('#GiftsStrip').hide()
}
//what I think might work:
if ($w('#GiftsButton').onClick(wixLocation.to("/luxury-gifts")))($w('#Gift1000Button').onClick(wixLocation.to("/gifts-under-1000"))) {
hideAllStrips()
}
// Adding the if statement to all the buttons in the strips with their proppero wix location, and at the end to call the function to hide all the strips
The problem is it wont let me add a coma or something between button functions in the if statement or I haven’t found the way to do it.
you can see the site in www.dargenta.com
Please help