Carousel 2x workaround – is this OK?

Hi,
waiting for Carousel to support 2x images (prettyplease! :slight_smile: ), I’m adding this in the generated html:

was:

<div class="carousel-item"><img class="d-inline-block w-100" src="img/open-book-2.jpg"/><div class="carousel-caption"></div></div>

is:

<div class="carousel-item"><img class="d-inline-block w-100" src="img/open-book-2.jpg" srcset="img/open-book-2@2x.jpg 2x"/><div class="carousel-caption"></div></div>

I.e., I’m adding the srcset prop pointing to the 2x image with the 2x spec. Is just this OK?
Thank you!

Davide

Hi @undavide welcome back,

You can use img + srcset along with the size attribute:

Or since Blocs is already using lazySizes.js you could use its inherent abilities alternatively:


EDIT: I forgot our conversion from … a year ago (thread from 2 years ago).

@norm, yes support directly built into the carousel brics by default would be nicer though. :wink:

3 Likes

Hi, sorry to jump back every couple of years: I understand there’s still no retina support on Carousel in V4, correct? (insert crying emoji)
Thanks

It so happens that I have to edit one of my website every other year :grin:—can I ask you whether in the last version of Blocs, carousels have gotten the 2x/3x image options?
Thanks!

Don’t think so. But you could try and target the image inside the carousel tag and set an aspect ratio like:

.your-class {
  aspect-ratio: 2 / 3;
}

Not yet, just a single image.

CleanShot 2023-10-25 at 08.55.37@2x

1 Like

Welcome back @undavide :grin:

^ It has only been 5 years since your first inquiry on this, so maybe with your next trip back through you will have reason to finaly celebrate, or perhaps not then either. :upside_down_face:

Check back tomorrow.

4 Likes

Should have waited for 6 years Norm. Even numbers and OCD triggers :joy::joy:

You should have waited for 5 more months @Norm. It would have made it exactly 5 years. Odd numbers rule the world! :joy: :five:

Wednesday, April 25, 2018 - to - Thursday, October 26, 2023 (Today)
= 5 years , 6 months and 2 days.

But regardless of a few months here or there, it was a long time coming and makes sense to have it included within Blocs. So a big congrats to @Norm for finally pulling through and @undavide for his continued persistence. Everyone wins except Jerry’s math teacher.

3 Likes

In this part of the globe, the thread began on 9th February 2019 :calendar:. Even with my trusty Casio calculator :abacus: at hand, the calculations reveal only four years have passed. :nerd_face:I suppose I’ll be seeking a refund from my mathematics instructor later today. :joy:

2 Likes

Hiya, and thanks @Norm!
I was considering upgrading from v4 given the Black Friday (I’ve to frantically update my website, too :grin:)—I’ve checked the release notes but there’s no mention of the Carousel, will I find it there anyway?
Thanks, and happy Thanksgiving to everyone living in a country where Thanksgiving is a thing :wink:

—Davide

Its in the current beta version of Blocs which is scheduled for release in the coming weeks.

If you upgrade today, you’ll get access (note this feature is still in testing).

1 Like

Will surely do, thanks!

1 Like