2

really new to everything related to coding.

I have a project in uni where we need to create a website in wix for a store. I intended to have a menu with green buttons and for the button color to change when clicked (e.g: going from page a to page b, you'll click on page b and when this happens, the button should change to blue).

After several hours on research I have a video which was demonstrating the functionality for a box, I thought I would apply the same to a button but no luck (nothing changes at my end). Any ideas would be highly appreciated. Thanks a lot!

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

export function ShoesPageButton_click(event){

        if($w("#ShoesPageButton").style.backgroundColor==="rbga(53, 91, 53, 1)"){

        $w("#ShoesPageButton").style.backgroundColor="rgba(127, 204, 247, 1)"

        }else{

        $w("#ShoesPageButton").style.backgroundColor="rgba(53, 91, 53, 1)"

        }
}
Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
Annie
  • 21
  • 2

1 Answers1

2

You have a typo, instead of "rgba" you have written "rbga" on the 1st line of the if statement.

$w("#ShoesPageButton").style.backgroundColor === "rgba(53, 91, 53, 1)"

Also not sure I understood "going from page a to page b, you'll click on page b and when this happens, the button should change to blue" - Are you trying to say that the click is occurring on page A and the button is on page B?

Shan
  • 948
  • 1
  • 9
  • 17
  • Thank you for looking into this @Shan! What I meant was: assuming I am on the page "Boots" (which contains the menu buttons "Boots", "Sandals", "Running Shoes" - the menu is the same on all pages), and I want to click on the "Running Shoes" button (which will take me to the "Running Shoes" page). When I land on this page "Running Shoes"), I wanted the correspondent menu button to be of a different color. But the more I think about it, the more I realize it is probably easier to just remove that button all together while on page. Thank you very much for your help – Annie Jan 13 '21 at 20:14