Skip to content

Compatibility with lazySizes #258

@zitrusblau

Description

@zitrusblau

We found an issue when lazyloading iframes (i.e. youtube video embeds) with the popular lazysizes script.

Apparently, fitVids needs the src attribute to be set in order to init itself on the target.
Without it, fitVids refuses to function.
Since lazySizes needs a data-src attribute and doesn't replace it with a src attribute once it is lazyloaded, we need to do it by hand.

This has actually nothing to do with fitVids but we thought we'd share it here, in case someone else might run into this.

We solved it this way:
https://gist.github.com/zitrusblau/47e9dbc58806b32bc6f1e7d869de638e

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