top of page
Anchor 1

Wix Tutorial - Button to Open a Strip, using Wix Code

When a user clicks on a button, a box expands. When the user moves the mouse outside of the box, then the box collapses. This can be useful when coding a mega menu. The same can be done with strips.

Elements:

  • Blue Button: #button1

  • Orange Button: #button2

  • Blue Box: #menubox1  |  Collapsed on load

  • Orange Box: #menubox2  |  Collapsed on load

Wix Code:

export function button1_click(event) {
    $w("#menubox1").expand();
    $w("#menubox2").collapse();
}

export function button2_click(event) {
    $w("#menubox2").expand();
    $w("#menubox1").collapse();
}

export function menubox1_mouseOut(event) {
    $w("#menubox1").collapse();
}

export function menubox2_mouseOut(event) {
    $w("#menubox2").collapse();
}

menus

Demo:

Click on the buttons below to expand the boxes that are currently collapsed.

Button
Button
Menu Box Collapse and Expand
bottom of page