Webanizr Logo
Open / sluit menu
Module countdown

The countdown module starts a countdown that is able to countdown in two different ways depending on the given countdown mode. It can countdown to a given duration and whenever you reload the countdown it starts over or the countdown can countdown to a specified fixed date and reloading the countdown such as refreshing the page doesn't affect the duration of the countdown.

syntax

webanizr.collect('countdown', parameters, callback);

parameters

The collect method of countdown accepts the following three parameters.

mode__countdown (required)

Mode of the countdown. There are two different modes for countdown.

Mode of the countdown can be a fixed countdown that countsdown to a specific date which specified on time__vars variables. Since it is a countdown to a certain date, it keeps counting down to that date no matter what. 

Mode of the countdown can also be a duration countdown that countsdown to a certain amount of time which specified on time__vars variables. In duration mode, whenever a page reloads the countdown starts over.

id__countdown (required)

The id of countdown. It is used to specify a countdown and helps to separate the countdowns in order to have multiple countdowns in single page.

time__vars (required)

The amount of time to countdown. It can be entered in two different ways for two different countdown modes.

For the fixed mode there are 7 different time variables, 3 of them are required variables and 4 of them are optional variables. These are the year, month, day, hour, minute, second and milisecond of a specific date. First 3 variables are the required ones.

For the duration mode there are 4 required variables. Which are amount of days, hours, minutes and seconds to countdown to.

callback

The function to pass the data onto after the number of seconds have passed.

variables

The countdown creates and updates the following variables:

countdownid (where countdown id is the value of the parameter id__countdown)

In this variable id of the countdown elements are stored. That id is used in 5 different places which are days, hours, minutes, seconds variables of the countdown and that id is also used for the variable that controls whether the countdown is finished or not. It is updated every time a countdown is added.

demos

https://cdn.cpmodules.webanizr.com/demo/countdown-and-show/index.html