// Creating the plugin$.fn.countup = function(prop){ var options = $.extend({ callback : function(){}, start : new Date() // Changing this to "start" },prop); // Tename the "left" variable to "passed" var passed = 0, d, h, m, s, positions; init(this, options); positions = this.find('.position'); (function tick(){ // Calculate the passed time passed = Math.floor((new Date() - options.start) / 1000); // Calculate the passed minutes, hours and days d = Math.floor(passed / days); updateDuo(0, 1, d); passed -= d*days; h = Math.floor(passed / hours); updateDuo(2, 3, h); passed -= h*hours; m = Math.floor(passed / minutes); updateDuo(4, 5, m); passed -= m*minutes; // Number of seconds passed s = passed; updateDuo(6, 7, s); // Calling an optional user supplied callback options.callback(d, h, m, s); // Scheduling another call of this function in 1s setTimeout(tick, 1000); })(); // This function updates two digit positions at once function updateDuo(minor,major,value){ switchDigit(positions.eq(minor),Math.floor(value/10)%10); switchDigit(positions.eq(major),value%10); } return this;};$('#countdown').countup();$('#countdown').countup({ start: new Date(2012, 10, 27, 15, 58, 21) //year, month, day, hour, min, sec});
文件目录······
暂无数据
猜你喜欢
更多»
项目推荐
更多»
PDF电子书
更多»
Java多线程编程核心技术
(2)
Linux命令详解词典.pdf
(5)
深入Python3中文版
(0)
百度SEO一本通.pdf
(0)
mysql必知必会.pdf
(2)
疯狂JAVA讲义 pdf电子书
(3)
C# 图解教程pdf电子书
(3)
研磨设计模式 pdf电子书
(0)