- Download the files from Flickity here and enqueue JavaScript & CSS by following Enqueue Scripts & CSS
- Create a
Div
and:- Set
class
→main-carousel
- Set
width
→100%
- Set
display
→block
- Add
JavaScript
→var flkty = new Flickity( '.main-carousel', { // options cellAlign: 'left', contain: true });
- Set
- Create another
Div
inside the firstmain-carousel
-Div
and:- Set
class
→carousel-cell
- Set
width
→100%
- Set
height
→300px
- Set
- Duplicate the
carousel-cell
-Div
to create more slides.
One useful options is wrapAround: true
for infinite scrolling.
Several other options available here
Is is very easy to integrate Flickity with the Repeater element, almost the same as above.
- Add a
Repeater
and:- Set
class
→main-carousel
- Add
JavaScript
→var flkty = new Flickity( '.main-carousel', { // options cellAlign: 'left', contain: true });
- Set
- Set a query of your choice
- Open the
Div
inside theRepeater
and:- Set
class
→carousel-cell
- Set
- Insert any element you like!