首页

源码搜藏网

首页 > 网页特效 > jQuery特效 >

jQuery Countdown Timer一款简单的 jQuery 倒计时插件

创建时间:2014-05-17 14:31  

jQuery Countdown Timer一款简单的 jQuery 倒计时插件
jQuery Countdown Timer一款简单的 jQuery 倒计时插件
效果预览 立即下载
jQuery Countdown Timer一款简单的 jQuery 倒计时插件,用于显示剩余的天数,小时,分钟和秒。

$(function(){ var note = $('#note'), ts = new Date(2012, 0, 1), newYear = true; if((new Date()) > ts){ // The new year is here! Count towards something else. // Notice the *1000 at the end - time must be in milliseconds ts = (new Date()).getTime() + 10*24*60*60*1000; newYear = false; } $('#countdown').countdown({ timestamp : ts, callback : function(days, hours, minutes, seconds){ var message = ""; message += days + " day" + ( days==1 ? '':'s' ) + ", "; message += hours + " hour" + ( hours==1 ? '':'s' ) + ", "; message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and "; message += seconds + " second" + ( seconds==1 ? '':'s' ) + " <br />"; if(newYear){ message += "left until the new year!"; } else { message += "left to 10 days from now!"; } note.html(message); } }); });
上一篇:jQuery带遮罩阴影网址导航
下一篇:jquery制作精美的评分插件

相关内容

热门推荐