How to do lazy loading image with srcset?

前端 未结 3 1925
太阳男子
太阳男子 2021-02-05 20:23

I\'m using slick.js to build a carousel. However, even though I change the attribute from src to data-lazy the images still get loaded before I scroll

3条回答
  •  野性不改
    2021-02-05 21:13

    I recommend responsivelyLazy. The implementation is SEO-friendly and does not mess your HTML code. Here is a snippet:

    As you can see the value in the src attribute is not modified.

    Read more at http://ivopetkov.com/b/lazy-load-responsive-images/

提交回复
热议问题