I have a Countdown timer in my home page and I am trying to find a way to hide it when it reaches the time.
I had to build the countdown in a section so it can be editable under customise. And now I am struggling to find a way to hide this section at the end of the countdown
I tried to do a function inside the script, but it’s not working.
function hideCountdown(){
var endTime = new Date( "{{ countdown_date }}" + "{{ countdown_month }}" + "{{ countdown_year }}" + " {{ countdown_time }}" + " GMT+01:00");
endTime = (Date.parse(endTime) / 1000);
if endTime == true {
$("#thecountdown").hide();
}
};
My friend told me that I could sort it out with jQuery and the hide() method. However I am not very jQuery experienced and I tried different options but nothing seems to work, I am not sure if I am writing the right syntax.
Hi @MandasaTech ! Thanks for your suggestion, unfortunately it did’t work The countdown is still showing up and counting -1 day now. That’s why I thought I had to write a function outside the makeTimer function. But I am not sure.
And worked!!! The countdown is hid! However, when I refresh the page, it comes back!! So I just need to find a way of the hide() to be absolute. Thanks anyway!! Your suggestion led me to the solution!
I’m running the same timer but wanted to see if anyone could tell me how to hide it server side? meaning not use CSS to hide it from the frontend but complete filter it out from rendering on the front end in a liquid filter?