I'm using the jQuery Countdown plugin and have a quick query.
My code currently looks like this:
function doCountdown(){
var nextNoon = new Date();
if (nextNoon.getHours()>=12){ nextNoon.setDate(nextNoon.getDate()+1); }
nextNoon.setHours(11,30,0,0);
$('h3 .timer strong').countdown({until: nextNoon, compact: true,
description: '', onExpiry: function(){doCountdown()}});
}
$(window).load(function(){
doCountdown();
});
So basically, it counts down untill the next 11:30AM
. However I need it to reset the counter when it reaches 11:30AM
, so it will automatically go to 23:59:59
on the timer.
Currently it just sticks at 00:00:00
even though the doCountdown
function is called onExpiry
(tested with console.log
and it definitely calls it).
Is it because javascript bases the time off page load and then stores it?