So I’ve solved the issue by looping through all of the items by class and indexing them with a data attribute.
$( '.tiled-gallery').each(function(){
var i = 0;
$(this).find('.tiled-gallery-item').each(function(){
$(this).attr( 'data-index', i );
i++;
})
})