Skip to content

Instantly share code, notes, and snippets.

@rmorse
Last active April 12, 2022 17:09
Show Gist options
  • Save rmorse/dc3171e6b8fba05aad010da8278cafba to your computer and use it in GitHub Desktop.
Save rmorse/dc3171e6b8fba05aad010da8278cafba to your computer and use it in GitHub Desktop.
// re init layout after ajax request
$( document ).on( "sf:ajaxfinish", ".searchandfilter", function( e, data ) {
if ( window.elementorFrontend && window.elementorFrontend.elementsHandler && window.elementorFrontend.elementsHandler.runReadyTrigger) {
var runReadyTrigger = window.elementorFrontend.elementsHandler.runReadyTrigger;
runReadyTrigger( data.targetSelector );
// NEW - re-init elementor widgets inside the new results:
var ajaxTarget = $( data.targetSelector );
if ( ajaxTarget.length > 0 ) {
ajaxTarget.find( '.elementor-widget' ).each( function () {
runReadyTrigger( $( this ) );
} );
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment