Type Definitions
CountdownExpiryCallback()
Countdown expiry callback.
Used with the
onExpiry option and
triggered when the countdown expires.
This:
Element
- Source:
Example
onExpiry: function() {
alert('Done');
}
CountdownServerSyncCallback() → {Date}
Countdown server synchronisation callback.
Used with the
serverSync option and
triggered when the countdown is initialised.
This:
$.countdown
- Source:
Returns:
The current date/time on the server as expressed in the local timezone.
- Type
- Date
Example
serverSync: function() {
var time = null;
$.ajax({url: 'http://myserver.com/serverTime.php',
async: false, dataType: 'text',
success: function(text) {
time = new Date(text);
}, error: function(http, message, exc) {
time = new Date();
});
return time;
}
CountdownTickCallback(periods)
Countdown tick callback.
Used with the
onTick option and
triggered on every tickInterval ticks of the countdown.
This:
Element
Parameters:
| Name | Type | Description |
|---|---|---|
periods |
Array.<number> | The breakdown by period (years, months, weeks, days, hours, minutes, seconds) of the time remaining/passed. |
- Source:
Example
onTick: function(periods) {
$('#altTime').text(periods[4] + ':' + twoDigits(periods[5]) +
':' + twoDigits(periods[6]));
}
CountdownWhichLabelsCallback(num) → {number}
Countdown which labels callback.
Used with the
whichLabels option and
triggered when the countdown is being display to determine which set of labels
(labels, labels1, ...) are to be used for the current period value.
Parameters:
| Name | Type | Description |
|---|---|---|
num |
number | The current period value. |
- Source:
Returns:
The suffix for the label set to use, or zero for the default labels.
- Type
- number
Example
whichLabels: function(num) {
return (num === 1 ? 1 : (num >= 2 && num <= 4 ? 2 : 0));
}