jQuery Based JavaScript Timers Replacement - Timer

jQuery Based JavaScript Timers Replacement - Timer
File Size: 84.5 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Timer.js is a jQuery based timer that can be used to replace the native JavaScript Timer functions such as setTimeout(), setInterval() and more.

More Examples:

Basic usage:

1. Download and load the jQuery timer.js script after jQuery library.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jquery-timer-min.js"></script>

2. Create a countdown timer on a DOM element that will start after one minute (1000 ms).

$("SELECTOR").setTimer(function(i, count) {
  $(this).text(count);
}, 1000, 10, true, function() {
  $(this).text("OK");
});

3. Create a basic counter that counts up from zero.

$("SELECTOR").setTimer(function(i) {
  $(this).text(function(i, t) {
    return t * 1 + 1;
  });
}, 1000, 10, true);

4. Plugin parameters.

  • fun (Function, Default: $.noop): timer function
  • time  (Number, Default: 2000):  timer interval
  • iCount  (Number, Default: 1): 0 OR -1 = no limit
  • immediately (Boolean, default:false): execute the function immediately
  • callback  (Function, default: $.noop): callback function fired on complete

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