jQuery Countdown Drupal Module

Provides the jQuery Countdown plugin by Keith Wood, along with a simple API function (jquery_countdown_add) to easily add countdown/countup timer elements to the page.

Submodule: jquery_countdown_block

There is a submodule called "jQuery Countdown Block" - we can use this submodule to provide one or more countdowns as a Block. It´s very easy go to "admin/build/block" and click on the local task "Add countdown block". Now configure the countdown how ever you want. After save you have now a block that can be placed on every region.

Example for development usage:

We can use jQuery Countdown in two different ways, one is using theme('jquery_countdown'), the other is using jquery_countdown_add(). The following would display the amount of time since the New Year...

<?php
 
echo theme('jquery_countdown', array(
   
'since' => date("F d, Y g:i a", mktime(0,0,0,0,0,2009)),
   
'format' => 'YOWDHMS',
   
'description' => t('Since New Year'),
  ));
?>

In this example, we display an alert box saying "You are done!" after counting down from 10...

<?php
 
echo '<div class="countdown">10 seconds!</div>';
 
jquery_countdown_add(".countdown", array("until" => 10, "onExpiry" => "finished"));
 
drupal_add_js("function finished() { alert('You are done!'); }", 'inline');
?>

Project Information

Downloads