Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A fancy countdown timer for jQuery
branch: master

This branch is 1 commit ahead of martinaglv:master

Closing <span> tag required for IE8

Without both the opening and closing tags, IE8 will not add the necessary markup. This does not affect any other browsers experience.
Failed to load latest commit information.
countdown Closing <span> tag required for IE8
readme.md Added a readme

readme.md

jQuery Countdown

A simple jQuery plugin for creating a countdown timer. Example:

$(function(){

    var note = $('#note'),
        ts = new Date(2012, 0, 1),
        newYear = true;

    if((new Date()) > ts){
        // The new year is here! Count towards something else.
        // Notice the *1000 at the end - time must be in milliseconds
        ts = (new Date()).getTime() + 10*24*60*60*1000;
        newYear = false;
    }

    $('#countdown').countdown({
        timestamp   : ts,
        callback    : function(days, hours, minutes, seconds){

            var message = "";

            message += days + " day" + ( days==1 ? '':'s' ) + ", ";
            message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
            message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
            message += seconds + " second" + ( seconds==1 ? '':'s' ) + " <br />";

            if(newYear){
                message += "left until the new year!";
            }
            else {
                message += "left to 10 days from now!";
            }

            note.html(message);
        }
    });

});

For more examples go to the plugin homepage on Tutorialzine.

Something went wrong with that request. Please try again.