Can I modify the running setInterval time? In fact, it is possible. This article will share with you the method of modifying the running time period with js setinterval. I hope it can help you.
function setDeceleratingTimeout(callback, factor, times){ var internalCallback = function(tick, counter) { return function() { if (--tick >= 0) { window.setTimeout(internalCallback, ++counter * factor); callback(); } } }(times, 0); window.setTimeout(internalCallback, factor);};// console.log() requires firebug setDeceleratingTimeout(function(){ console.log('hi'); }, 10, 10);setDeceleratingTimeout(function(){ console.log('bye'); }, 100, 10);
Related recommendations:
javascript implementation code to determine time period
How does mysql obtain statistics within a specified time period? Detailed explanation of data code
The above is the detailed content of js setinterval method to modify the running time period. For more information, please follow other related articles on the PHP Chinese website!