I have the following $.each which loops through an object. Every 5 seconds the get_file() function is called. Is there anyway to include a Pause and Resume option. So that if I click Pause the loading of the data stops. And of course when I click a Resume button it starts up again from where it left off.
Hope someone can help.
$.each(obj, function (i, v) {
setTimeout(function () {
file = v.new_file;
var timeline_date = moment(v.last_modified_date).format("dddd, MMMM Do YYYY, h:mm:ss a");
bHover = 0; //re-highlight links
$(".timeline_msg").html(timeline_date);
get_file(file);
}, 5000 * (i + 1));
});