I have followed the tutorial and added the code but my button does nothing.
I am a complete newbie here but i checked the code and it matches wix…
Having looked at other threads people are putting other code and text count into the box. This isnt mentioned at all in the tutorial and as iv spent 3 days getting frustrated can someone point me in the right direction, please?
My button is designed to show specifics about a product.
Any help gratefully received
Dani
Please post your code
Hi there and ty so I did it again and I have used the edited templates from velo and again even though the code is correct and shows no errors does not do anything once on my site. I have tried other browsers too …
the boxes are their, the hand scrolls over but the tabs do not change.
$w.onReady( function () {
const yellowColor = “#E7AE01” ; // For selected tab
const whiteColor = “#FFFFFF” ; // For other tabs
$w( '#DNButton' ).onClick(() => {
$w( '#DNStatebox' ).changeState( "DNState" );
});
$w( '#keyfButton' ).onClick(() => {
$w( '#DNStatebox' ).changeState( "KeyState" );
});
$w( '#specButton' ).onClick(() => {
$w( '#DNStatebox' ).changeState( "SpecState" );
});
$w( '#photoButton' ).onClick(() => {
$w( '#DNStatebox' ).changeState( "PhotoState" );
});
$w( "#DNStatebox" ).onChange((event) => {
const buttonNames = [ “DN” , “keyf” , “spec” , “photo” ];
buttonNames.forEach(buttonName => {
let button = $w( “#” + buttonName + “Button” ); // e.g. $w(“#keyboardsButton”)
let state = buttonName + “State” ; // e.g. keyboardsState
if (event.target.currentState.id === state) {
button.style.backgroundColor = yellowColor;
} else {
button.style.backgroundColor = whiteColor;
}
});
});
});