top of page
Change self color
Change buttons in box
button
button
button
button

CODE:

let state = 0;

export function button1_click(event) {

let currentButtonStyle = $w("#" + event.target.id).style;

state === 0 ?   currentButtonStyle.backgroundColor = "rgb(255,0,0)" : currentButtonStyle.backgroundColor = "rgb(13,94,186)";

state = (state + 1) % 2;

}

let inBoxState = 0;

export function button2_click(event) {

    let elmsToChangeBg = $w("#box1").children;

    let newColor = "rgb(13,94,186)";

    if(inBoxState === 0) {newColor =  "rgb(255,0,0)";}

    elmsToChangeBg.forEach(e => e.style.backgroundColor = newColor);

    inBoxState = (inBoxState + 1) % 2;

}

FOOTER

bottom of page