I have a problem with adding simple animation/effects to the show() and hide() functions in Wix Classic Editor. By way of example, in the following code I’ve assigned an OnClick function to two buttons. Button 1 simply toggles visibility of a container (box1) and button 2 does the same, but with the addition of a fade effect. Button 1 works exactly as expected, but button 2 does nothing at all (doesn’t show/hide the box and doesn’t log to the console). If I remove the fade effect from button 2, it also works as it should. I expect I’m missing something simple, but have been left scratching my head.
$w.onReady(function () {
$w("#button1").onClick(() => {
if ($w("#box1").hidden) {
$w("#box1").show().then(() => {
console.log("Box is now visible");
});
} else {
$w("#box1").hide().then(() => {
console.log("Box is now hidden");
});
}
});
$w("#button2").onClick(() => {
if ($w("#box1").hidden) {
$w("#box1").show('fade').then(() => {
console.log("Box is now visible");
});
} else {
$w("#box1").hide('fade').then(() => {
console.log("Box is now hidden");
});
}
});
});