Wix Tutorial - Change Site Content in Response to a User Interaction, using Wix Code

This example shows how to use events as users interact with your site and change your site content accordingly.

An event handler is used to change between the tabs. 

Elements:

Elements:

  • Button Description: #button1    |   Add onClick event in the Properties Panel

  • Button Gallery: #button2    |   Add onClick event in the Properties Panel

  • Box for Description: #description

  • Box for Gallery: #gallery

Wix Code:

export function button1_click(event) {
    $w("#description").show();
    $w("#gallery").hide();
}

export function button2_click(event) {
    $w("#description").hide();
    $w("#gallery").show(); 
}

Demo:

This is a description of the property, the number of bedrooms, bathrooms, and how many people the property can accommodate.

Wix Code Change Content.jpg

Websites designed by WixCreate that use the above Wix Code: