vasyabigi / angular-slick

Angular directive for slick-carousel
http://vasyabigi.github.io/angular-slick/
MIT License
500 stars 237 forks source link

Jittery behavior when using with responsive configuration #92

Open gkohen opened 9 years ago

gkohen commented 9 years ago

Hi,

I'm using the this pretty awesome slick component with the responsive configuration as follows:

this.myCardConf =[
      {
        breakpoint: 3000,
        settings: {
          slidesToShow: 6,
          slidesToScroll: 6,
          infinite: false,
          dots: false
        }
      },
      {
        breakpoint: 1024,
        settings: {
          slidesToShow: 4,
          slidesToScroll: 4,
          infinite: false,
          dots: true
        }
      },
      {
        breakpoint: 768,
        settings: {
          slidesToShow: 3,
          slidesToScroll: 3,
          infinite: false,
          dots: true
        }
      }
    ]

The slick is defined as follows:

                <slick  infinite="true" responsive="myCardConf">
                    <div class="card-tile-wrapper"
                         ng-repeat="card in cards">
                        <card-tile
                                tile-data="tileData">
                        </card-tile>
                    </div>
                </slick>

the card-tile directive shows a tile with an image and some text. The problem is that when the view is first initialized slick carousel shows the tiles in an initial location and then re-arranged. In IE the process my take few seconds which is visually unpleasing. As expected it's better on Chrome but the re-position is process is still visible. I've tried using init-onload=true but then slick does not space out the tiles but rather bunches them together on the left. I'm using angular-slick 0.1.18 as the in the latest 0.2.1, ng-click on tiles seems to work intermittently on the latest version.

Any idea on how circumvent this and initially show the fully laid out carousel?

Thanks

amrfaisal commented 9 years ago

Check my answer for Angular use-case: http://stackoverflow.com/questions/29101254/angularjs-slick-js-carousel-ng-click-not-firing-with-responsive-attribute-settin/30584787#30584787