Flickity 2 - groupCells and pageDots do not work at the same time

I am new to flickity and I want to group cells and display dots at the same time. But in my project, they seem to be mutually exclusive, I can either group cells or display points, even if from this codepen they work well together.

What am I doing wrong?

Here is my code

MyPage:

this html is part of the template in my angularjs user directive:

app.directive('productSlider', function ($rootScope, $compile, $timeout, $sce, $location, $window) {

    return {
        restrict: 'E',
        template: '<section id="products" >' +
            '<div class="prodotti-int gallery js-flickity" id="productSlider" data-flickity=\'{ "groupCells": 4 }\' >' +
            ... +

here is my jquery inside the link method of my directive:

$('#productSlider.gallery').flickity({
                            // options
                            cellAlign: 'center',
                            freeScroll: true,
                            wrapAround: false,
                            contain: true,
                            autoPlay: 0,
                            prevNextButtons: false,
                            pageDots: false
                        });

In this case, the cell is grouped correctly, but I do not see the point. To see the points, I need to remove the groupCells property.

What am I doing wrong?

Note: this code works on one page.

thank

+4
1

( , - , ), , , :

$('.carousel').flickity({
  contain: true,
  groupCells: 4
});
/* external css: flickity.css */

* { box-sizing: border-box; }

body { font-family: sans-serif; }

.carousel {
  background: #EEE;
}

.carousel-cell {
  width: 28%;
  height: 200px;
  margin-right: 10px;
  background: #8C8;
  border-radius: 5px;
  counter-increment: carousel-cell;
}

.carousel-cell.is-selected {
  background: #ED2;
}

/* cell number */
.carousel-cell:before {
  display: block;
  text-align: center;
  content: counter(carousel-cell);
  line-height: 200px;
  font-size: 80px;
  color: white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/flickity@2.0/dist/flickity.css" media="screen">
<script src="https://unpkg.com/flickity@2.0/dist/flickity.pkgd.min.js"></script>


<h1>Flickity - groupCells</h1>
<div class="carousel" id="mycarousel" data-flickity='{"groupCells": 4 }'>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
  <div class="carousel-cell"></div>
</div>
Hide result

, .

0

Source: https://habr.com/ru/post/1655095/


All Articles