Button Clicked

Hello, i am creating a page and i would like to have the “Cloud Button” (green button) already clicked for when someone views my website. Then the user can choose to click other buttons and another image will come up. I am using Wix Code to generate the steps, but im not able to figure out a code to have the button remained clicked


.

Help? If this doesnt make sense let me know, tried my best to explain it.

Hi Carolina,

You can use Wix Code to change the background color of your button. When the page loads, it appears that your button has been “clicked”. When visitors click on other buttons, change the background color of all other buttons and display the new image.

For example:
$w(" #button1 “).style.backgroundColor = “rgb(255,255,255)”;
$w(” #button 2").style.backgroundColor = “rgb(0,0,0)”;
$w(" #button 3").style.backgroundColor = “rgb(0,0,0)”;

Here’s a website with API documentation and reference examples for changing button style in Wix.
https://www.vorbly.com/Vorbly-Code/WIX-CODE-CUSTOMIZE-BUTTON-STYLE

Hope it helps!

Cheers,
Ben

Did you get the solution? can you give me this? I face same problem

All you need to know is shown above.

Here you have the example for the ordinary-Wix-Editor…

For example: (ordinary-wix-editor)

$w('#button1').style.backgroundColor = 'rgb(255,255,255)';
$w('#button2').style.backgroundColor = 'rgb(0,0,0)';
$w('#button3').style.backgroundColor = 'rgb(0,0,0)';

Here you can manage the color of your buttons by code, setting a specific button to a specific color, which would differ from all other buttons, simulating a clicked button, or to be more precise → simulation a SELECTED button.

If you want to generte such a function on Wix-Studio, you can use CSS.