• Resolved wprox

    (@wprox)


    Hi Florian,

    Thank you for the great plugin πŸ™‚

    I am trying to use responsive image with the picture element. I am able to get WP to generate srcset for my “source” as well as the img.

    However, the code in the DOM of the one source I’ve added for art direction looks like this:
    <source media=”media query” src=”Desktop-1920-x-631.jpg” sizes=”100vw” class=”wp-image-3″ srcset=”Desktop-1920-x-631.jpg 1920w, Desktop-1920-x-631-300×99.jpg 300w, Desktop-1920-x-631-768×252.jpg 768w, etc”>

    When this media query is true, it loads the right image from source, but does not lazy load it.
    When this media query is false, lazysizes loads the right image from the img section below the source.

    According to lazysizes: The picture element is also supported. Simply add the lazyload class to the img and use data-srcset on your source and the img element.
    The img element is fine with data-sizes and data-srcset, the “data” is not being added to the source.

    Thanks for your help!

Viewing 3 replies - 16 through 18 (of 18 total)
Viewing 3 replies - 16 through 18 (of 18 total)

The topic ‘Image not lazyloading’ is closed to new replies.