admin管理员组文章数量:1313385
I was trying to achieve count up timer with this jquery plugin.
As I am newbie on this, I really don't understand their documentation.
What I want to display is. I want to display counter which counts from 1st January 2005 till current date. Example of output display is
5 years 5months 5hours 5seconds (seconds will be keep counting)
Please kindly help me by posting snippets to achieve. Thanks for your time and greatly appreciated.
I was trying to achieve count up timer with this jquery plugin.
As I am newbie on this, I really don't understand their documentation.
What I want to display is. I want to display counter which counts from 1st January 2005 till current date. Example of output display is
5 years 5months 5hours 5seconds (seconds will be keep counting)
Please kindly help me by posting snippets to achieve. Thanks for your time and greatly appreciated.
Share Improve this question asked May 6, 2010 at 4:14 knightriderknightrider 2,5837 gold badges30 silver badges42 bronze badges4 Answers
Reset to default 7try:
var sinceYear = new Date('01/01/2005');
$('#defaultCountdown').countdown({since: sinceYear});
quick demo
edit 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
$('#since').countdown({ since: new Date(2005, 1 - 1, 1) });
You're looking for since
.
<html>
<head>
<title>Sample Page</title>
<script type="text/javascript" src="http://ajax.googleapis./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>
code untested. you will need to acmodate the location of the script files yourself.
Edited:
<script type="text/javascript">
$('#defaultCountdown').countdown({ since: new Date(2005, 0, 1) });
</script>
<span id="defaultCountdown" class="countdown"></span>
本文标签: javascriptJquery Countup TimerStack Overflow
版权声明:本文标题:javascript - Jquery Countup Timer - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741880916a2402740.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论