現(xiàn)在要實(shí)現(xiàn)一個(gè)頁面中可以包含多個(gè)倒計(jì)時(shí).
我找了個(gè)插件:https://github.com/Reflejo/jquery-countdown
可是當(dāng)包含多個(gè)倒計(jì)時(shí)的時(shí)候,后面幾個(gè)會(huì)發(fā)生翻轉(zhuǎn)速度過快的問題。一秒中應(yīng)該翻牌一次,可是有時(shí)候會(huì)翻兩三次。
演示地址:http://cakephpchina.com/jquery-countdown/1.html
實(shí)例下載:http://cakephpchina.com/jquery-countdown.zip
技術(shù)有限,請大神指點(diǎn)
$(function(){
o1 = {
image: "img/digits.png",
format: "dd:hh:mm:ss",
endTime: new Date(2014, 12, 2)
}
$(".digits1").countdown(o1);
$("#change").click(function(event) {
// $("document").stop(true, true).finish();
$(".digits1").stop(true, true).finish().html('').remove();
o1 = null;
o2 = {
image: "img/digits.png",
format: "dd:hh:mm:ss",
endTime: new Date(2014, 12, 2)
};
$(".digits2").countdown(o2);
});
});
學(xué)習(xí)是最好的投資!
換了個(gè)更強(qiáng)大的倒計(jì)時(shí)插件 http://flipclockjs.com/ 支持單個(gè)網(wǎng)頁包含多個(gè)倒計(jì)時(shí)
你應(yīng)該去了解一下setInterval
函數(shù)的使用方法
當(dāng)你每次點(diǎn)擊的時(shí)候,需要進(jìn)行clearInterval()