I have read the post here about using setTimeout() during intensive DOM processing (using JavaScript), but how can I integrate this function with the below code? The below c
You would need to rewrite the function to cache the element list, then loop over the list using a counter of some sort.
Then when the counter reaches counter % max_num_before_wait == 0, call timeout back to the function itself.
Make sure to clear the cache and counter at the end of the complete list, or use a secondary function with an extra count parameter.