• Topic says it, having problem with Search and Filter Pro after ajax call, images are not loaded.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Same issue any help with this. Did you figure it out?

    Thread Starter zadine

    (@zadine)

    Sadly not, tried to add lazyLoadInstance.update(); to ajax call but plugin doesn’t seem to recognise it. Ended up removing ajax from Search and Filter altogether.

    Thread Starter zadine

    (@zadine)

    Got this fixed with this:

    if (function_exists('rocket_lazyload_textdomain')) {
    
        /**
         * Make sure Rocket Lazy Load updates after Ajax Complete
         */
        function rae_lazyload_update_ajax($script)
        {
            $output = $script;
            $output .= '<script id="load-after-lazyload">window.addEventListener("LazyLoad::Initialized", function(e) {
            var lazyLoadInstance = e.detail.instance;
            
                const send = XMLHttpRequest.prototype.send
                
                XMLHttpRequest.prototype.send = function() { 
                    this.addEventListener("load", function() {
                        lazyLoadInstance.update();
                    })
                    return send.apply(this, arguments)
                }
        });
        </script>';
    
            return $output;
        }
    
        add_filter('rocket_lazyload_script_tag', 'rae_lazyload_update_ajax');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to update lazyload after Ajax call?’ is closed to new replies.