-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature Request: Add Setting for object-fit Cover vs. Contain #15
Comments
Thanks for this. I'm not quite sure yet how we should address this, as the problem doesn't just occur in the swiper but everywhere. Here's basically what I think we need
@jeremy-farrance your thoughts? |
I don't think its a setting where you would want or need to change it on a per-pic basis. I can't think of a use case for that at the moment, though I am sure there are some. There is a fairly common use-case for displaying logos (and diagram components, etc) and those images usually are on a white or transparent background. Its all or nothing at the module level. Here is an incomplete demo I did on this last year, CSS only, no frameworks, and not related to Swiper. You are introducing a lot of great additional functionality with your thoughts above though, and most of these we've needed in the past, some we've built to a limited extent, but they mostly seem separate. I am glad to see you've encountered MANY situations where slicing and dicing images got complicated. :) So, some quick thoughts.
before:
after:
|
One other thing I almost forgot to point out - and this is just my humble opinion and not well thought through - but, in regards to 1 and 3 (and others) I have the perception that instead of building (too) many settings/options with complex output scenarios, the MUCH easier approach would be to include an existing functional library (.NET or JS?) that instead lets the user manually crop and resave the image (optionally keeping the original?). I realize the technical debt of introducing a dependency, but I definitely feel with would be a much better solution to the in-the-moment case where the image ends up displaying a way that makes the user want to change it (even when they don't know how, which results in a support ticket or email). Anyhow, I hope that idea is on your radar and that you see how many exponential edge-cases it could solve for (which would be hard to account for in settings and code). Cheers!! |
The way SwiperJS is used it assumes photos, so the CSS (.app-sw... picture img) applies
object-fit: cover
. If you want to use logos or other types of images where cover doesn't make sense, the simple fix isobject-fit: contain
.In the next version it would be an awesome setting to add at both the default, app/page/module levels.
The problem demonstrated with COVER
And fixed with CONTAIN
The text was updated successfully, but these errors were encountered: