Not sure if this helps, but here is the jQuery plugin that I came with to reorder the list of elements, starting with the provided index:
$.fn.reorder = function(head) { var arr = this; var rest = arr.splice(head, arr.length - head); return rest.concat(Array.prototype.slice.call(arr, 0)); };
In this example, calling .reorder(3) move all elements beyond the 3rd index to the beginning of the array, allowing you to $.each over your collection with $.each in the expected order.
Rob M.
source share