Hi,
Is there a way to show multiple slides at once using the Blazor carousel component?
I have a requirement that is similar to the image below. Thanks.
Hi David,
Greetings from Syncfusion support.
Yes. You can create multiple slides at once in the Carousel component by looping the list of carousel items from the carousel data source as shown in the below code.
[Index.html]
|
<SfCarousel AnimationEffect="CarouselAnimationEffect.Fade"> @foreach (CarouselData data in CarouselDatas) { <CarouselItem> <div style="display:flex;height:100%"> @foreach (CarouselItemModel item in data.Items) { <figure class="img-container"> <img src=Images/@item.ImageName style="height:100%;width:100%;" /> <figcaption class="img-caption">@item.Text</figcaption> </figure> } </div> </CarouselItem> } </SfCarousel> |
|
List<CarouselData> CarouselDatas = new List<CarouselData> { new CarouselData { Items = new List<CarouselItemModel> { new CarouselItemModel(){Text = "Image 1" , ImageName="bee-eater.png" }, new CarouselItemModel(){Text = "Image 2" , ImageName="cardinal.png" }, new CarouselItemModel(){Text = "Image 3" , ImageName="costa-rica.png" } } }, new CarouselData { Items = new List<CarouselItemModel> { new CarouselItemModel(){Text = "Image 4" , ImageName="hunei.png" }, new CarouselItemModel(){Text = "Image 5" , ImageName="kaohsiung.png" }, new CarouselItemModel(){Text = "Image 6" , ImageName="bee-eater.png" } } }, new CarouselData { Items = new List<CarouselItemModel> { new CarouselItemModel(){Text = "Image 7" , ImageName="cardinal.png" }, new CarouselItemModel(){Text = "Image 8" , ImageName="costa-rica.png" }, new CarouselItemModel(){Text = "Image 9" , ImageName="hunei.png" } } } }; |
Output:
Kindly try the attached sample and let us know if this meets your requirement.
Regards,
Ruksar Moosa Sait
That's what I need. Cool, thanks.
Hi David,
Thanks for the update.
We are happy that your problem has been resolved now.
Regards,
Satheesh Kumar B
This solution in my opinion is not complete, due the fact that the carousel scroll each page. what if i want a carousel thet scroll signle item but show for instance 3 item, maybe focusing at the central item ?
Hi David,
You can achieve your requirement by using the Carousel PartialVisible property. The following sample and documentation illustrates
the solution. Please give it a try, and let us know if you need any further
assistance.
Sample: https://blazor.syncfusion.com/demos/carousel/partial-visible?theme=fluent
UG: https://blazor.syncfusion.com/documentation/carousel/populating-items#partial-visible-slides
Regards,
Ashok