Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Masonry custom size › Reply To: Masonry custom size
March 24, 2023 at 4:13 pm
#41954
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
}