Skip to content

ignores acutal image widths when scaling with CSS transforms #19

@ghost

Description

resposively-lazy does not support CSS Transforms (e.g. scale) with calculations of actual image widths

This can be fixed by using element.getBoundingClientRect().width instead of element.offsetWidth

change
var containerWidth = container.offsetWidth * window.devicePixelRatio;
to
var containerWidth = container.getBoundingClientRect().width * window.devicePixelRatio;

Demo
https://codepen.io/thcreate/pen/700d3a105243db29443d236fcf858626

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