CountDown.js
一個用來實現簡單頁面倒計時的輕量級工具
API
CountDown.openTimeCountBySeconds()
根據要計時的秒數打開一個顯示剩余時間的倒計時
參數:
ps:以上均為可選參數
示例
CountDown.openTimeCountBySeconds({ Ele: document.getElementById('h1'), CountDownSeconds: 3600, Sign: 'flypie', Divider: ':', EndFunc: function () { console.log('end'); } });
CountDown.openTimeCountByStartAndEndDate()
根據計時開始和結束時間打開一個顯示剩余時間的倒計時
參數:
ps:除StartDate,EndDate外均為可選參數
示例
var startDate = new Date(); var endDate = new Date(); endDate.setDate(endDate.getDate()+1); CountDown.openTimeCountByStartAndEndDate({ Ele: document.getElementById('h1'), StartDate: startDate, EndDate: endDate, Sign: 'flypie', Divider: ':', EndFunc: function () { console.log('end'); } });
CountDown.openTimeCountByStartAndEndDate()
根據計時開始和結束時間打開一個顯示剩余天數加時間的倒計時
參數:
ps:除StartDate,EndDate外均為可選參數
示例
var startDate = new Date(); var endDate = new Date(); endDate.setDate(endDate.getDate()+10);CountDown.openDateAndTimeCountByStartAndEndDate({ Ele: document.getElementById('h1'), StartDate: startDate, EndDate: endDate, Sign: 'flypie', Divider: ':', DateDivider: '天 ', EndFunc: function () { console.log('end'); } });
CountDown.stopBySign()
根據標記零時暫停一個倒計時
CountDown.stopBySign('flypie');
CountDown.resumeBySign()
根據標記恢復一個被零時暫停的倒計時
CountDown.resumeBySign('flypie');
CountDown.closeBySign()
根據標記永久性地關閉一個倒計時
CountDown.closeBySign('flypie');
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對VeVb武林網的支持。
新聞熱點
疑難解答