KK Countdown

Installation / Download

NPM

npm install --save kk-countdown

Examples

Simple

                    
const countdown = new KKCountdown();
countdown.container = document.getElementById('app-2');
countdown.countTo = '2018-12-01T12:00:00.00';
countdown.start();
                    
                

Contdown control

                    
const countdown = new KKCountdown({
  textAfterCount: '',
  oneDayClass: 'kk-test',
  displayDays: true,
  displayZeroDays: true,
  customClass: 'kk-custom',
  afterFinish: () => {},
  warnSeconds: 60,
  warnClass: 'kk-warn',
});
countdown.container = document.getElementById('app-1');
countdown.countTo = moment().add(10, 'd');
countdown.start();

document.getElementById('app-1-start').addEventListener('click', () => {
  countdown.start();
});

document.getElementById('app-1-stop').addEventListener('click', () => {
  countdown.stop();
});
                    
                

Countdown

                    
const countdown = new KKCountdown({
  textAfterCount: '',
  afterFinish: () => { console.log('===> FINISH!!!'); },
  warnSeconds: 60,
});
countdown.container = document.getElementById('app-3');
countdown.countTo = 65;
countdown.start();
                    
                

Options

option default description
textAfterCount '' (string)
oneDayClass '' (string)
displayDays true (bool)
displayZeroDays true (bool)
customClass '' (string)
warnSeconds 60 (number)
warnClass '' (string)
afterFinish (function)
dayText day (string)
daysText days (string)
hourText hour (string)
hoursText hours (string)
minuteText : (string)
minutesText : (string)
secondText '' (string)
secondsText '' (string)
containerClass kkcd-container (string)
secondsClass kkcd-seconds (string)
minutesClass kkcd-minutes (string)
hoursClass kkcd-hours (string)
daysClass kkcd-days (string)
secondsTextClass kkcd-seconds-text (string)
minutesTextClass kkcd-minutes-text (string)
hoursTextClass kkcd-hours-text (string)
daysTextClass kkcd-days-text (string)