FacetWP – trigger Envira Gallery on ajax refresh

<?php

// Add to your (child) theme's functions.php

add_action( 'wp_head', function() {
?>
<script>
(function($) {
    $(document).on('facetwp-loaded', function() {
        $(document).trigger('envira_load');
    });
})(jQuery);
</script>
<?php
}, 100 );