jquery 倒计时插件和实例,jCountr——运用了jQuery.Countdown.js,结合 jquery.js而完成的倒计时效果,用法请看代码,不是太复杂。
[code]
jQuery.fn.countdown = function(options) {
/**
* app init
*/
if(!options) options = '()';
if(jQuery(this).length == 0) return false;
var obj = this;
/**
* break out and execute callback (if any)
*/
if(options.seconds < 0 || options.seconds == 'undefined')
{
if(options.callback) eval(options.callback);
return null;
}
/**
* recursive countdown
*/
window.setTimeout(
function() {
jQuery(obj).html(String(options.seconds));
--options.seconds;
jQuery(obj).countdown(options);
}
, 1000
);
/**
* return null
*/
return this;
}
[/code]

本文系作者在时代Java发表,未经许可,不得转载。
如有侵权,请联系nowjava@qq.com删除。