top of page

Published: January 22, 2020

Updated: January 22, 2020

1

1602

How to Add a Tab Feature to Your Multi-State Tab Box on Wix - Wix Code Tutorial 2021 - Velo

Category(s)

-Side Menu-
Category

Title

Want to know in-depth details on how you can set up a multistate box that creates a tab effect for your Wix website by using Wix Code a.k.a. Velo??


Here is the helpful code to get you going! Let me know if you need any more assistance in the comments on YouTube or contact me at the bottom today!


📚 WHAT WAS COVERED:

Add Buttons and Multi-State Box Elements to Editor

Create and Code the OnChange State Box Function

Add Finish Element to Editor

Save and Preview Results in Preview Mode

 

Code Snippet to follow along with the video:


Page Code


This loads the page code


$w.onReady(function () {
    button1_click()
});
}


Set each button function.



export function button1_click(event) {
    $w("#statebox8").changestate("State1");
}

export function button2_click(event) {
    $w("#statebox8").changestate("State2");
}

export function button3_click(event) {
    $w("#statebox8").changestate("State3");
}

export function button4_click(event) {
    $w("#statebox8").changestate("State4");
}
    

Set the statebox onChange Event Handler Function



const blackColor = "#000000";
const greyColor = "#C7C7C7";

export function statebox8_change(event) {
 const buttonNames = $w("#column5").childtren.filter((elem) => { return elem.id.includes("button") }).map((f) => { return f.id}); //[1,2,3,4]

    buttonNames.map((name, index) => {
 let button = $w(`"${name}`): // e.g. $w("#button1")
 let length = index+1;
 let state = "State"+length; // e.g. State1
 //console.log(state);
 if (event.target.currentState.id === state) {
            button.style.backgroundColor = blackColor;
        } else {
            button.style.backgroundColor = greyColor;
        }
    })
}
    


 

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

📺 MY PLAYLISTS :

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

💻 WEBSITE
Check out more of the website. If you have a question, let's chat it up below! More information coming soon so stay tuned!


Comments


SIGN UP

Get notified of upcoming articles.

Get Started
View More Categories
Images
Animations
Recent Post

Haga clic aquí para agregar su

propio contenido, o conectarse.

creativelynino_00001.png
YouTube

Haga clic aquí para agregar su

propio contenido, o conectarse.

creativelynino_00001.png
YouTube

Haga clic aquí para agregar su

propio contenido, o conectarse.

creativelynino_00001.png
YouTube

Haga clic aquí para agregar su

propio contenido, o conectarse.

creativelynino_00001.png
YouTube

Did this help?

Yes
No

Thanks, we'll pass on your feedback to improve our services.

Survey
Contact
Feedback

TAKE THE SURVEY

We would love to hear from you.  We strive to create content that is valuable to all persons with and without coding experience.  Please fill out this anonymous survey about your Corvid learning experience.
GET STARTED
bottom of page