• Resolved junx0r

    (@junx0r)


    Hello,

    I love the image lazy load – very useful. Is there any way to control it with an offset so the images load just a little bit sooner as you scroll down? For example, when you are 400 pixels away, the image loads. This would make for a smoother experience. As it is now, it doesn’t fire until you are very close to the image, and there is a blank space for a split second if you scroll down at a relatively fast pace. I’d love to be able to load images just a little bit sooner.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    AO’s lazyload relies on lazysizes JS library and esp. the loadmode and expand parameters might help you to get the images loaded a little bit sooner (assuming the images themselves are not too heavy, as that will inevitably slow their display down), see https://github.com/aFarkas/lazysizes/blob/gh-pages/README.md for more info on those params.

    You can change from the AO’s default parameters with e.g. this code snippet;

    
    add_filter( 'autoptimize_filter_imgopt_lazyload_jsconfig', function() { 
        return '<script>window.lazySizesConfig=window.lazySizesConfig||{};window.lazySizesConfig.loadMode=1;lazySizesConfig.expand=750;</script>';
    });

    hope this helps,
    frank

    Thread Starter junx0r

    (@junx0r)

    Thank you, that works perfectly. (As a suggestion, it would be great to have a field for this in a future update if you like the idea)

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

    re. the extra options, I’ll add it to my backlog for later (re-)consideration.

    enjoy your weekend!
    frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image lazy load offset?’ is closed to new replies.