JQuery count timer

I was trying to achieve a countdown timer using the jquery plugin .

Since I'm new to this, I don't really understand their documentation.

I want to display. I want to display a counter that is calculated from January 1st, 2005 to the current date. Output display example

5 years 5 months 5 hours 5 seconds (will keep records in seconds)

Please kindly help me by posting snippets for the achievement. Thanks for your time and very grateful.

+2


a source to share


4 answers


try:

var sinceYear = new Date('01/01/2005');
$('#defaultCountdown').countdown({since: sinceYear});​

      

quick demo



change more options

var sinceYear = new Date('01/01/2005');
$('#defaultCountdown').countdown({since: sinceYear,
                                  format: 'YdHMS',
                                  layout:'<b>{yn} {yl},{dn} {dl} and '+ 
                                       '{hn} {hl}, {mn} {ml}, {sn} {sl}</b>'});​

      

another quick demo

+7


a source


Edited:



<script type="text/javascript">
    $('#defaultCountdown').countdown({ since: new Date(2005, 0, 1) }); 
</script>

<span id="defaultCountdown" class="countdown"></span>

      

0


a source


$('#since').countdown({ since: new Date(2005, 1 - 1, 1) });

      

You are looking for since

.

0


a source


<html>
  <head>
    <title>Sample Page</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <style type="text/css">@import "jquery.countdown.css";</style> 
    <script type="text/javascript" src="jquery.countdown.js"></script>
    <script type="text/javascript">
      var epoch = new Date("1/1/2005");
      $(document).ready(function(){
        $("#countup").countdown({since: epoch});
      });
    </script>
  </head>
  <body>
    <div id="countup">

    </div>
  </body>
</html>

      

not verified. you will need to host the location of the script files yourself.

0


a source







All Articles