A simple jQuery Countdown Timer with callback

Hi Guys,

While I was working for a project I was doing some basic things, one of which was to display a counter of 10 seconds and then firing up a callback function.

Now I know this may not be the best out there but its extendible and you can add animations and that kinda stuff to it.

Pre-requisites

  • jQuery library
  • Javascript enabled in browser

Here is the code snippet

[geshi lang=”javascript” nums=”1″ target=”_self” ]

 

And this is how you use it

First a container. This can be anything a Div, span, p etc but with a unique ID

[geshi lang=”html5″ nums=”1″ target=”_self” ]

And now lets call our jquery function on above div

[geshi lang=”javascript” nums=”1″ target=”_self” ]

Above function will fire alert after 10 seconds. You can control the interval between each step and Max and min range.

I hope this helps

To improve this function please add your input in comments.

Cheers,

 

Advertisement

 

 

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply