Minimal Countdown Timer In Seconds Using jQuery

Minimal Countdown Timer In Seconds Using jQuery
File Size: 4.47 KB
Views Total: 186
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

An extremely lightweight (~400 bytes) jQuery seconds countdown plugin that counts down from specific seconds, with or without repetition.

How to use it:

1. Load the JavaScript countdownTimer.min.js after jQuery library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/src/countdownTimer.min.js"></script>

2. Create a container to hold the countdown timer.

<p>
  Countdown
  <span id="example"></span> 
  Seconds.
</p>

3. Initialize the plugin and specify the number of seconds you want to count down from. Default: 5.

$('#example').countdownTimer({
  seconds: 10,
});

4. Determine whether to loop the countdown timer. Default: true.

$('#example').countdownTimer({
  seconds: 10,
  loop: false,
});

5. Execute a callback when the countdown ends.

$('#example').countdownTimer({
  seconds: 10,
  callback: function(){
    // do something
  }
});

This awesome jQuery plugin is developed by lee-ratinan. For more Advanced Usages, please check the demo page or visit the official website.