Heyhey!
I’m currently working on a website homepage which features a countdown of the days until an event. The code works perfectly on the web, but for some reason disappears on mobile.
Here’s the code I stitched together:
$w.onReady(function () {
$w("#group1").collapse()
countdownTimer()
});
async function countdownTimer() {
let date = await new Date("Jun 8, 2022 16:00:00").getTime();
let downTime = setInterval(function () {
let nowtime = new Date().getTime();
let diff = date - nowtime;
let days = Math.floor(diff / (1000 * 60 * 60 * 24));
let hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((diff % (1000 * 60)) / 1000);
$w("#days").text = days.toString();
$w("#hours").text = hours.toString();
$w("#minutes").text = minutes.toString();
$w("#seconds").text = seconds.toString();
$w("#group1").expand();
$w("#box13").collapse();
if (diff > 0) {
//continue the timer
} else {
clearInterval(downTime);
$w("#box13").expand();
$w("#group1").collapse();
}
}, 1000)
}
If anyone could help me out if you find that there’s anything I missed that may be causing this, or if I am missing any specific code to make it visible on mobile, I’d really appreciate it!
Thank you!!