facetwp-loaded Event
Overview
This JS event gets triggered when FacetWP finishes refreshing. It’s triggered after a user interacts with a facet or pagination control. This event is useful for modifying facet output after being rendered.
Usage
Example 1: scroll to the top of the page after an ajax refresh:
<script>
(function($) {
document.addEventListener('facetwp-loaded', function() {
window.scrollTo(0, 0);
});
})(jQuery);
</script>
Example 2: reinitialize Jetpack Lazy Load after an ajax refresh:
<script>
(function($) {
document.addEventListener('facetwp-loaded', function() {
fUtil('body').trigger('jetpack-lazy-images-load');
});
})(jQuery);
</script>