I have a simple question, that is giving me some problems. I am trying to configure a countdown timer, so that it would show the remaining hours, seconds and minutes. I got some great code online, but I have to modify it, so that it is dependant of the current time and not the time when somebody visits the site.
The code I use is this: http://tutorialzine.com/2011/12/countdown-jquery/
I have been working on the script.js and corrected this:
$(function(){
var note = $('#note'),
ts = new Date(2012, 0, 0,0,0),
newYear = true;
if((new Date()) > ts){
// The new year is here! Count towards something else.
// Notice the *1000 at the end - time must be in milliseconds
var uraJe = new Date();
var ura = 24 - uraJe.getHours();
var minute = 60 - uraJe.getMinutes();
var sekunde = 60 - uraJe.getSeconds();
ts = (new Date()).getTime() + ura*60*60*1000;
newYear = false;
}
$('#countdown').countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
var message = "";
note.html(message);
}
});
});
When I run it, it does show the hours correctly, but the minutes are not.
How can I correct that?