metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.53k stars 602 forks source link

Function call option values #855

Closed arl1nd closed 6 years ago

arl1nd commented 6 years ago

Hi there,

I was wondering if you can provide function-call options values so whenever the 'resize' is triggered from Flickity these 'function' values options will have chance for alternatives upon screen size, an example:

let myCarousel = new Flickity( {
  wrapAround : () => window.innerWidth > 992,
  groupCells : () => {
    let cells = 4;
    if ( window.innerWidth < 992 ) {
      cells = 3;
    } else if ( window.innerWidth < 768 ) {
        cells = 2;
    }
    return cells;
  }
} );

I think this would increase the flexibility and make Flickity even more responsive friendly.

desandro commented 6 years ago

See one possible solution here: https://github.com/metafizzy/flickity/issues/233#issuecomment-218465900 Let's keep discussion on that thread.