Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to install a handler for when countdown reaches 0 or something similar? #5

Open
sharky93 opened this issue Jul 14, 2014 · 2 comments

Comments

@sharky93
Copy link

Cannot find anything in the docs.

@gatoona
Copy link

gatoona commented Jul 18, 2014

You can use the tick.

Example:

$(function(){
var NY = Math.round((new Date('7/25/2014 22:00:00')).getTime()/1000);
$('#i405').flipcountdown({
size:'sm',
tick:function(){
var nol = function(h){
return h>9?h:'0'+h;
}
var range = NY-Math.round((new Date()).getTime()/1000),
secday = 86400, sechour = 3600,
days = parseInt(range/secday),
hours = parseInt((range%secday)/sechour),
min = parseInt(((range%secday)%sechour)/60),
sec = ((range%secday)%sechour)%60;
if (range <=0){

alert("Countdown has Reached 0!");
return;
}

            else{
    return nol(days)+' '+nol(hours)+' '+nol(min)+' '+nol(sec);
    document.getElementById("countdown_complete").style.visibility="hidden";}

}

});

});

@farzadso
Copy link

This doesn't work and stays in the if clause and keeps on showing the alert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants