Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Issue with Lazy Loading of images › Reply To: Issue with Lazy Loading of images
January 3, 2020 at 4:16 pm
#25210
Participant
Ok, I tried this snipet and added another extra code to close search filters once a filter is applied on mobile (it’s an usability adjustment), however it is breaking up my website, creating an infinite loop and making my website load and load until browser just breaks.
/*trigger the lazyload once the search filtering is finished*/
jQuery(function($) {
var t;
$('body').on("DOMSubtreeModified", function(event, id, instance, phrase) {
clearTimeout(t);
setTimeout(function(){
$(window).scroll();
$(document).scroll();
//Also remove filter screen on mobile once results are loaded
if($('.close-sidebar').length){
$('.close-sidebar').click();
}
}, 1000);
});
});
I really need to catch the exact event once the search filter is applied…