Hi, I have to following script to add countdown timer in the store section. However uploading the script in index.html isn't working. Can someone pls assist with this feature? Many many thanks in advance!
<script>
(function() {
var start = new Date;
start.setHours(11, 0, 0); // 11am
function pad(num) {
return ("0" + parseInt(num)).substr(-2);
}
function tick() {
var now = new Date;
if (now > start) { // too late, go to tomorrow
start.setDate(start.getDate() + 1);
}
var remain = ((start - now) / 1000);
var hh = pad((remain / 60 / 60) % 60);
var mm = pad((remain / 60) % 60);
var ss = pad(remain % 60);
document.getElementById('time').innerHTML =
hh + "h " + mm + "m " + ss + "s ";
setTimeout(tick, 1000);
}
document.addEventListener('DOMContentLoaded', tick);
})();
</script>
Order cut off in <span id='time'></span>