Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignores acutal image widths when scaling with CSS transforms #19

Open
ghost opened this issue Aug 30, 2017 · 1 comment
Open

ignores acutal image widths when scaling with CSS transforms #19

ghost opened this issue Aug 30, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 30, 2017

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

@ivopetkov
Copy link
Owner

Sounds correct. Can you please push the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant