Delay Function Execution With The delayDo jQuery Plugin
File Size: | 57.2 KB |
---|---|
Views Total: | 245 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
delayDo is a super tiny jQuery plugin to create a timer that can be used to delay the execution of specified JavaScript functions.
With this plugin, you can create meaningful timing transitions where animation functions are all added to the sequence and executed one by one after the specified interval.
See Also:
- Delay Event Handler Function For A Secified Elapsed Time
- Trigger Events After A Delay - jQuery onDelay
How to use it:
1. Load jQuery library and other necessary resources in the document.
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/dist/setAnimationFrameTimeout.min.js"></script> <script src="/path/to/dist/delayDo.min.js"></script>
2. Initialize the timer and add functions to the queue.
$.delayDo( 'timerId', function () { // do something. } );
3. Resume the timer.
$.delayDo.resume({ // timer ID timerId: 'timerId', // in milliseconds interval: 200, // in milliseconds delay: null, // fired after that the queue is empty complete: function () { // do something. } });
4. Clear the queue.
// clear a specific timer $.delayDo.cancel('timerId'); // clear all $.delayDo.bustercall();
This awesome jQuery plugin is developed by onopko. For more Advanced Usages, please check the demo page or visit the official website.