This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Masonry custom size

#41954
Ernest MarcinkoErnest Marcinko
Keymaster

Maybe the timeout trigger is not the best, can you try maybe this:

add_action('wp_footer', 'asp_add_footer_script', 99999);
function asp_add_footer_script() {
	?>
<script>
document.querySelectorAll(".asp_main_container").forEach(function(el){
  el.addEventListener("asp_search_end", function(event) { 
    window.dispatchEvent(new Event("resize"));
    setTimeout(function(){window.dispatchEvent(new Event("resize"));}, 100);
    setTimeout(function(){window.dispatchEvent(new Event("resize"));}, 500);
  });
});
</script>
	<?php
}