【问题标题】:Jquery Countup TimerJquery 倒数计时器
【发布时间】:2010-05-06 04:14:13
【问题描述】:

我试图用这个jquery plugin 实现倒计时。

由于我是这方面的新手,我真的不了解他们的文档。

我想展示的是。我想显示从 2005 年 1 月 1 日到当前日期的计数器。输出显示示例为

5 年 5 个月 5 小时 5 秒(秒数会持续计算)

请帮我通过发布sn-ps来实现。感谢您的宝贵时间,非常感谢。

【问题讨论】:

    标签: javascript jquery countdown


    【解决方案1】:

    尝试:

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

    demo

    编辑 更多选择

    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>'});​
    

    另一个快速demo

    【讨论】:

    • 是的,它有效。但显示显示为 Days Hours Minutes Seconds。我想显示的是 Years Month Hours Minutes 。请帮助。谢谢。
    • 非常感谢。它工作得很好。也感谢演示。我不能投票,因为我没有足够的代表。对此感到抱歉。
    【解决方案2】:
    $('#since').countdown({ since: new Date(2005, 1 - 1, 1) });
    

    您正在寻找since

    【讨论】:

      【解决方案3】:
      <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>
      

      代码未经测试。您需要自己调整脚本文件的位置。

      【讨论】:

      • 是的,它有效。但显示显示为 Days Hours Minutes Seconds。我想显示的是 Years Month Hours Minutes 。请帮助。谢谢。
      【解决方案4】:

      已编辑:

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

      【讨论】:

      • 您好,这不是我要实现的目标。我想要实现的是使用自keith-wood.name/countdownRef.html 以来。你的代码得到关于 newYear 的错误是未定义的并且什么也不显示
      • @knightrider - 试试这个新的
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多