$w.onReady(function () {
var date = new Date();
var hours = date.getHours(); //3pm is 15
if(hours >= 15) {
$w("#banner").collapse(); // this code runs
} else {
console.log('i have NOT collapsed'); // AND this code runs
}
});
Does Velo / Wix do some kind of preprocessing where it prefers references to $w or something? I’m not new to JS but I am new to Wix.
expand-collapse work as expected + according to your first post the collapse did work.
and the code you posted is also fine. So the problem is probably somewhere else.
Maybe the time on your computer is not correctly set.
(The code you wrote uses the OS computer time).