timer - JQuery Countdown to Specific Date -


i'm trying figure out how build countdown timer in jquery countdown set date , once day arrives display message "available now" in place of countdown was.

i made animation show example of mean if helps:

http://i.stack.imgur.com/qythr.gif

can me? or maybe point me towards tutorial or show me how this? :)

thank much!

look @ this. made comments code. if questions ask, please. greetings andré

var availabledate=new date();  //set eg "may 12 2015 05:01:00"  availabledate.setdate(12);  availabledate.setmonth(4);//january has index 0!!!  availabledate.setfullyear(2015);  availabledate.sethours(5);  availabledate.setminutes(1);//january has index 0!!!  availabledate.setseconds(0);     var availabledatefield =$("#availabledate");  availabledatefield.text(availabledate);    var timefield =$("#time");    var t=setinterval(loop,1000); //(handler,intervall in ms)  function loop(){    //get current date (now)    var now=new date();    //get difference    var diff=availabledate - now;    //if time has come ;-)    if(diff<=0){           clearinterval(t);      timefield.text("time has come");      return false;    }    //if not    var str= "time wait: "+parsems(diff);        timefield.text(str);  }    function parsems(ms){    //todo you: years, months , days :-)    var hours = math.floor(ms/(3600000))    ms = ms % 3600000;    var minutes = math.floor(ms / 60000 );    ms = ms % 60000;    var seconds = math.floor(ms / 1000);    ms = ms % 1000;   			    var hoursstr = checkforzero(hours);    var minutesstr = checkforzero(minutes);    var secondstr = checkforzero(seconds);   			    var timestring = hoursstr + ":" + minutesstr + ":" + secondstr;    return timestring;  }    function checkforzero(i){    //write "0" before ?    str=i+"";    if (parseint(i,10) < 10) str = "0" + str;    return str;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div id=availabledate>  </div>  <div id=time>  </div>

0


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -