CountdownTimer Using Jquery
Hi friends,
In this tutorial I am going tell about how to create and use th countdown Timer using
Jquery.
In one of application the client want to display the count down [Link] that I choose
Jquery and put it in my application.
The original count down timer is get from David walsh
I slightly modify it and give it to you.
First you need to put the Jquery plugin.
/*
Class: countDown
Author: David Walsh
Modified by:Vinoth Kumar.S
Version: 1.0.0
Date: FEB 05 2010
Built For: jQuery 1.2.6
*/
[Link] = function(settings,to,id) {
settings = [Link]({
startFontSize: '36px',
endFontSize: '12px',
duration: 1000,
startNumber: 60,
endNumber: 0,
myid:id,
callBack: function() { }
}, settings);
return [Link](function() {
//alert([Link]);
//where do we start?
if(!to && to != [Link]) { to = [Link]; }
//alert([Link]);
//set the countdown to the starting number
//$(this).text(to).css('fontSize',[Link]);
hours = [Link](to / 60);
minutes = [Link](to % 60);
if (minutes < 10) {
minutes = "0"+minutes;
}
$(this).text(hours + ':' + minutes).css('fontSize',[Link]);
//loopage
var myhour=hours + ':' + minutes;
$.cookie('test',myhour,{expires:7,path:'/'});
$(this).animate({
'fontSize': [Link]
},[Link],'',function() {
if(to > [Link] + 1) {
$(this).css('fontSize',[Link]).text(to - 1).countDown(settings,to - 1);
}
else
{
$.cookie('test',null,{path:'/'});
[Link](this);
}
});
});
};
Then create the Html Page
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link] >
< html xmlns="[Link] >
< head >
< meta http-equiv="Content-Type" content="text/html; charset=utf-8" / >
< title > countdowntimer< /title >
< style type="text/css" >
@import "[Link]-1.5.5/css/[Link]";
#defaultCountdown { width: 240px; height: 45px; }
< /style >
< script type="text/javascript" src="jquery/[Link]" > < /script >
< script type="text/javascript" src="jquery/[Link]" > < /script >
< script type="text/javascript" src="jquery/[Link]" > < /script >
< script type="text/javascript" >
$(document).ready(function() {
$('#countdown').countDown({
startNumber: 25,
callBack: function(me) {
$(me).text('All done! This is where you give the reward!').css('color','#090');
$.cookie('test',null,{path:'/'});
//$(this).text(hours + ':' + minutes).css('fontSize',[Link]);
},
id:5
});
});
< /script >
< /head >
< body >
< p style="border:1px;margin:auto 0px;text-align:center;margin-top:250px;" >
< span id="countdown" > < /span >
< /p >
< /body >
< /html >
visit [Link] for more informations.
Please use this and leave the comment to us