Coutdown
Countdown plugin for jQuery, supporting DigitCountdown and TimeCountdown
Demo
Install
bower install digit-countdown
Quick Start
There are two mode, DigitCountdown and TimeCountdown, and they have the same options and API.
start
Start a countdown like this if you want a DigitCountdown:
var countdown = $(selector).digitCountdown();
countdown.start()
if you want a TimeCountdown then:
var countdown = $(selector).timeCountdown();
countdown.start()
stop
Stop a countdown like this:
countdown.stop()
and restart it by calling start().
resetOptions
You may want to reset the options of a running countdown, and restart it.
countdown.resetOptions(newOptions)
countdown.start()
Readmore APIs below.
Options
option | description |
---|---|
direction | counts direction, candidates are down and up. In DigitCountdown the default value is down, and up in TimeCountdown |
begin | begin digit, in TimeCountdown it's in millisecond |
end | begin digit, in TimeCountdown it's in millisecond |
period | he period betwwen each count, it's in millisecond |
counts | increase or decrease number each count, in TimeCountdown it's in millisecond |
beforePerCount | hook function before every count, the arguments is the current number it counts to |
afterPerCount | hook function after every count, the arguments is the current number it counts to |
onEnded | callback when the countdown finished |
API
- start(): start to countdown.
- stop(): stop a countdown.
- resetOptions(newOptions): stop the current countdown and reset it's options
- ended(): whether the coutdown is ended
- getCurrent(): get current value of the countdown
License
MIT