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

Use transforms instead of altering widths #1

Open
marcoms opened this issue Sep 18, 2017 · 3 comments
Open

Use transforms instead of altering widths #1

marcoms opened this issue Sep 18, 2017 · 3 comments

Comments

@marcoms
Copy link

marcoms commented Sep 18, 2017

Would it be possible to use CSS transforms instead of setting max-width? Transforms should be more performant especially on low-end devices.

@charlestati
Copy link
Owner

Yes, I've been thinking about that but using vw with max-width allows the image to scale to a known max-width.

Using transform: scale() how would you make sure the expanded image is <= 100% of the window width since it purposely overflows its container? I believe more JavaScript would be necessary here but I'm open to suggestions.

@ColCh
Copy link

ColCh commented Sep 20, 2017

If it overflows container (e.g. page), it's useful to make it draggable

See images behavior on Medium

@marcoms
Copy link
Author

marcoms commented Sep 20, 2017

Additional javascript would be required yes, although it shouldn't take too much to clamp the scale factor

To me the trade off would be worth it because afaik setting either width or max-width forces layout to run on each animated frame -- https://csstriggers.com/max-width, https://csstriggers.com/width

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

No branches or pull requests

3 participants