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

Comparison sliders don't fit images responsively #338

Closed
paambaati opened this issue Nov 16, 2017 · 11 comments
Closed

Comparison sliders don't fit images responsively #338

paambaati opened this issue Nov 16, 2017 · 11 comments
Labels

Comments

@paambaati
Copy link

paambaati commented Nov 16, 2017

Images under comparison sliders (especially when the "after" image is smaller than the "before") are not fit responsively — meaning the full image isn't displayed entirely; I assume it is because of the object-fit: none style. unsetting it shows the whole image, but the sliding motion stretches the image as we slide.

@picturepan2 Is there a more elegant solution?

@picturepan2
Copy link
Owner

@paambaati If you want to compare two images like that, you will need to have same sized images. Otherwise you can not compare them.

@paambaati
Copy link
Author

@picturepan2 Figured as much, thanks.

Do you plan to support responsive images inside comparison sliders?

@picturepan2
Copy link
Owner

@paambaati The update v0.4.6 with this fix is released.

@paambaati
Copy link
Author

@picturepan2 Thanks, but now with the object-fit: cover fix, the 'after' image moves with the slider, and is not perfectly superimposed over the 'original' image.

For example, see https://i.imgur.com/BJSGzps.gifv

@picturepan2
Copy link
Owner

@paambaati What is your browser and version?

@paambaati
Copy link
Author

paambaati commented Nov 20, 2017

@picturepan2 Chrome 64.0.3269.3 on macOS. Can confirm that this happens in Firefox 57 as well.

@picturepan2
Copy link
Owner

@paambaati Does this example work for you?

@paambaati
Copy link
Author

paambaati commented Nov 20, 2017

@picturepan2 That example works! But I'm trying to use this particular image - https://httgp.com/content/images/2017/11/me.jpg, and it doesn't work. I've tried this image on your website too (by just modifying the page source inline), and I get the same weird dragging effect.

Does this have to do with the aspect ratio of the image?

EDIT: Can confirm, it was the aspect ratio. The example uses an aspect ration of 1.77, while my image has an aspect ratio of 1.3! I made a 1.77 ratio crop, and I no longer see the issue! Is this expected, or would you suggest a better alternative?

@picturepan2
Copy link
Owner

@paambaati I don't have any issue even when I use other aspect ratio images. Can you show me your code?

@paambaati
Copy link
Author

@picturepan2 I'm privately beta testing it. Can I DM you?

@picturepan2
Copy link
Owner

@paambaati Yes, Email is fine. picturepan2@hotmail.com.

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

No branches or pull requests

2 participants