I'm trying to get a function to repeat itself once it starts, but I must be off today because I can't figure it out. Here's my code:
function runNext() {
galleryNext().delay(1500).runNext();
}
Thanks in advance.
If you want to call a function on a regular interval you should use setInterval()
.
var myFunction = function() {};
setInterval(myFunction, 1000); // call every 1000 milliseconds
If you ever need to stop the function from being called forever, setInterval() returns an id that you can use to stop the timer as well. Here's an example.
var myFunction = function() {};
var timer = setInterval(myFunction, 1000);
clearTimeout(timer);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With