Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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)"

        }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...