jquery 插件 countdown.js 倒计时插件

https://github.com/HugoGiraudel/Countdown.js

代码来源微擎应用市场

html代码:

<div class="count-down" data-countdown="2019-02-15 00:00:00">
                                <span class="num day">00span>
                                <span class="unit">span>
                                <span class="num hour">00span>
                                <span class="unit">span>
                                <span class="num minute">00span>
                                <span class="unit">span>
                                <span class="num second">00span>
                                <span class="unit">span>
                            div>
 

 js代码:

            $('[data-countdown]').each(function(index) {
                var $this = $(this);
                var finalDate = $this.data('countdown') || new Date();
                finalDate = finalDate.replace(/-/g,"/");
                $this.attr('id', 'countdown-' + index)
                new Countdown({  // Custom
                    selector: '#countdown-' + index,
                    dateEnd: new Date(finalDate),
                    leadingZeros: true,
                    //  {days}  days, {hours} hours, {minutes} minutes !'
                    msgPattern : '{days}'
                                + ''
                                + '{hours}'
                                + ''
                                + ' {minutes} '
                                + ''
                                + '{seconds}'
                                + '',
                    msgAfter: '活动结束',
                    onStart: function() { 
                    },
                    onEnd: function() {
                    }
                });
            })

 

转载于:https://www.cnblogs.com/tianyamike/p/10365144.html

你可能感兴趣的:(jquery 插件 countdown.js 倒计时插件)