jQuery.countdown 倒計時插件的使用


這個插件真的挺好用的,雖然好用但是我還是記下來吧,好多插件,今天修改項目的時候看見他居然懵逼

 

官網地址    http://hilios.github.io/jQuery.countdown/

 

 

時間的格式有三種 這些事官網上介紹的

 

 

第一個例子 

一個頁面多個倒計時  

<div data-countdown="2017/11/01"></div>
<div data-countdown="2017/11/01"></div>
<div data-countdown="2018/01/01"></div>
<div data-countdown="2019/01/01"></div>
<script src="jquery-1.11.3.min.js"></script>
<script src="jquery.countdown.js"></script>
<script>
$('[data-countdown]').each(function(){
var $this = $(this), finalDate = $(this).data('countdown');
$this.countdown(finalDate, function(event) {
$this.html(event.strftime('%D 天 %H:%M:%S'));
});
})

</script>

2.傳統模式的倒計時

<div id="clock"></div>
<script src="jquery-1.11.3.min.js"></script>
<script src="jquery.countdown.js"></script>
<script>
$('#clock').countdown('2017/10/10', function(event) {
var $this = $(this).html(event.strftime(''
+ '<span>%D</span> 天 '
+ '<span>%H</span> 小時 '
+ '<span>%M</span> 分鍾 '
+ '<span>%S</span> 秒'));
});
</script>



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM