Skip to content

Picture Element Lazy Loading #144

@Jab2870

Description

@Jab2870

Firstly, thanks fo creating this amazing tool. I use it on almost every website I build. I would, however, like to open a discussion about the way that picture elements are lazy-loaded.

Why not just put the class lozad on the picture element and add then, when it enters the viewport, change all data-srcset attributes to srcset attributes on the source elements and on the img element, do the same but also change data-src elements to src elements.

The markup would then just become

<picture class="lozad">
    <source data-srcset="image.png">
    <img data-src="image2.png">
</picture>

Adding the data-iesrc attributes to the picture elements etc just seems confusing to me and I'm not sure what benefit it brings.

I would be very happy to submit a PR if this is something you are interested in?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions