Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to use Slimsy to switch out crops of an image at different sizes? I can see how to use it for a single crop, but if you wanted to switch between different crops at different screen sizes is this feasible or is it best to write my own behaviour for it?
Example, on larger sizes I'm be looking to use a letterbox style crop, but on mobile I'm after a more square crop of an image. Tablet might be different as well.
You could, but you need to define breakpoints and crop sizes manually.
<source media="(max-width: 799px)" srcset="@Url.GetSrcSetUrls(yourMedia, 300, 200)" sizes="auto">
<source media="(min-width: 800px)" srcset="@Url.GetSrcSetUrls(yourMedia, 200, 300)" sizes="auto">
<img src="@Url.GetCropUrl(yourMedia, 200, 300)" srcset="@Url.GetSrcSetUrls(yourMedia, 200, 300)" sizes="auto">
In this example, if the viewport is below 800px, the browser will load an image in a ratio of 3 to 2, above 800px, it would be 2 to 3.
Ahh, great idea, yes this could work. :-) Thanks
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted