Tag Info

New answers tagged

1

The standard way to do this is to use setTimeout inside a function and call that function recursively, incrementing any values you need inside the function, rather than using setInterval. This allows you to pass variables into the function being called recursively, to either vary the calling interval or some other value, such as a lookup into an array, a ...


1

The answer is simple javascript to cancel the setInterval you created: var handle = setInterval(function() { // do something }, 100); function onCancel() { if (handle) clearInterval(handle); } Here's a working example using your code: http://jsfiddle.net/umwo0rn1/25/



Top 50 recent answers are included