• Resolved makobaby01

    (@makobaby01)


    Hello, I use slick slider to make the slider of my main page, but I would need to use the lazy load of the plugin, how would I do this?
    I use <picture> to have different sizes of images.

    Realizing this, I thought of applying loading = "lazy" but I could only use it on <img>and I would need to use it on <source> because the mobile that suffers the most.

    would that possibility?

    • This topic was modified 3 years, 11 months ago by makobaby01.
    • This topic was modified 3 years, 11 months ago by makobaby01.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hey there @makobaby01 thank you for reaching out

    I was wondering if you have any other slider on your site? I ask this because the one on your homepage is in the view, this means that it will not be lazy loaded.

    Regards,

    Jorge

    Thread Starter makobaby01

    (@makobaby01)

    @wpmudevsupport15 I only have a slider on the main page, does it mean that if it is only on the main page there will be no lazy loading?

    Wouldn’t there be a way for me to put it on? type a class to add in div and among others.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @makobaby01

    Are you using the Slick from scratch? if so, this library already provides a lazy loading feature:

    // To use lazy loading, set a data-lazy attribute
    // on your img tags and leave off the src
    
    <img data-lazy="img/lazyfonz1.png"/>
    
    $('.lazy').slick({
      lazyLoad: 'ondemand',
      slidesToShow: 3,
      slidesToScroll: 1
    });

    https://kenwheeler.github.io/slick/

    Sometimes those libraries will prevent the lazy loading plugins to work, but we would need to run a quick test.

    Could you let us know how you are adding the images? A regular HTML block or from PHP or using any plugin?

    Best Regards
    Patrick Freitas

    Thread Starter makobaby01

    (@makobaby01)

    I wear this on the head
    <img data-lazy="https://makobaby.com.br/wp-content/uploads/2018/02/ajax-loader.gif"/>

    And this in the footer

    ;(function($){
    $(document).ready(function() {
        $('.carousel').slick({
    		infinite: true,
        	dots: true,
    		arrows:false,
       		autoplay: true,
    		lazyLoad: 'ondemand',
        	autoplaySpeed: 6000,
      });
    });	
    })(jQuery);

    I’m adding an image on the basis of the html, which in this case I use WPbakery, then I put HTML and inserted my HTML from the slider, adding the images

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @makobaby01,

    Smush parses the page before it’s is displayed on DOM and Smush by default will only lazyload for images loaded via tags. I’m afraid there isn’t an easy workaround that could be suggested regarding such use case and would require custom coding.

    What you could do is to use the inbuilt Slick lazyload as mentioned by Patrick in the previous reply and exclude the images from Smush Lazyload settings to avoid any conflicts.

    Kind Regards,
    Nithin

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @makobaby01

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional question or problem.

    Best Regards
    Patrick Freitas

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use lazyload in picture tag’ is closed to new replies.