Skip to content

Latest commit

 

History

History
48 lines (44 loc) · 1.58 KB

flickity-carousel.md

File metadata and controls

48 lines (44 loc) · 1.58 KB

Flickity Carousel

Image of Flickity Carousel

Tutorial

  1. Download the files from Flickity here and enqueue JavaScript & CSS by following Enqueue Scripts & CSS
  2. Create a Div and:
    • Set classmain-carousel
    • Set width100%
    • Set displayblock
    • Add JavaScript
       var flkty = new Flickity( '.main-carousel', {
       	// options
       	cellAlign: 'left',
       	contain: true
       });
  3. Create another Div inside the first main-carousel-Div and:
    • Set classcarousel-cell
    • Set width100%
    • Set height300px
  4. Duplicate the carousel-cell-Div to create more slides.

One useful options is wrapAround: true for infinite scrolling.
Several other options available here

Repeater

Is is very easy to integrate Flickity with the Repeater element, almost the same as above.

  1. Add a Repeater and:
    • Set classmain-carousel
    • Add JavaScript
       var flkty = new Flickity( '.main-carousel', {
       	// options
       	cellAlign: 'left',
       	contain: true
       });
  2. Set a query of your choice
  3. Open the Div inside the Repeater and:
    • Set classcarousel-cell
  4. Insert any element you like!

Advanced Custom Field (ACF)

  • Filter the Repeater-Query with your Custom Post Type
  • Insert for example a text-element, Insert Data → Advanced Custom Field Options Image of Flickity Carousel Repeater ACF