Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Add max-width/height options #273

Open
RafaPolit opened this issue Oct 12, 2017 · 2 comments
Open

Add max-width/height options #273

RafaPolit opened this issue Oct 12, 2017 · 2 comments

Comments

@RafaPolit
Copy link
Contributor

I am showcasing images optimized for retina displays (@2x) which are 2400px width, forced to display at 1200px.

When I refernce those images inside lightbox, setting the "width" option to a size SMALLER than the image file has no effect. It only works for EXPANDING original image files, but larger files are not scaled down.

What I really would want is to have a 'max-width/max-height' option that will allow for the modal to be as small as needed and grow no further than XXX pixels, to keep image display to its best.

Thanks,
Rafa.

@ashleydw
Copy link
Owner

Sounds like adding two new data-* attributes is the best thing to do, and then in the _resize method check that the attribute value is < maxHeight and width and use which ever is most appropriate.

@ashleydw ashleydw changed the title width / height options not working if source is larger Add max-width/height options Oct 13, 2017
@RafaPolit
Copy link
Contributor Author

RafaPolit commented Oct 13, 2017

Yeap, I have implemented that approach in a pull request (with added options in the example HTML file), and also improving a bit some padding / aspect ratio issues.

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

No branches or pull requests

2 participants