Carousel for Resources


(Gereon Goldbach) #1

Maybe somone can help or has an idea: I like to create a flexible carousel for resources (shown as bootstrap cards). I want to select the resources with a repeat link field to create the carousel. The card will generated with a snippet and the id from +link_raw. It works allready with single columns in ContentBlock. My Question is, how can I genrate the carousel. Due I have to generate the indicators and the cards, I have to run the link ids twice to create the carousel. A quick fix would be to create a field with additional fields with a fixed number of cards, so that I have to create only the cards. But this is not flexibile. Maybe it is possible to get the IDs from the link fields as an array to run a snippet? I have allready a solution in migx, but I would like to control the carousel in contentblock and not in seperate tv tabs. Any help is appreciated. Gereon

html source:
< div class=“carousel”>
Indicators
< ol>
< li class=“active”>1< /li>
< li>2< /li>

< /ol>
< div class=“carousel-inner”>
< div class=“carousel-item”>1 Card< /div>
< div class=“carousel-item”>2 Card< /div>

< /div>
< /div>


(Gereon Goldbach) #2

I found a quick solution. I use a dropdown field for the number of images and pass this value to a snippet to build the ol. With a second field, I set the active class for one image to start the slider.